fixed output template for logging.
This commit is contained in:
parent
9316f08a73
commit
24e550d612
@ -13,7 +13,7 @@ public class HostBuilderFactory<TStartup> where TStartup : class
|
||||
if (!string.IsNullOrWhiteSpace(baseDirectory))
|
||||
configurationBuilder.SetBasePath(baseDirectory);
|
||||
|
||||
configurationBuilder.AddJsonFile("appsettings.protected.json", optional: true);
|
||||
configurationBuilder.AddJsonFile("appsettings.protected.json", optional: true, reloadOnChange: true);
|
||||
})
|
||||
.UseSerilog((ctx, logBuilder) =>
|
||||
{
|
||||
|
||||
@ -7,7 +7,7 @@ public class ShortSourceContextEnricher : ILogEventEnricher
|
||||
{
|
||||
if (logEvent.Properties.TryGetValue("SourceContext", out var sourceContextValue))
|
||||
{
|
||||
var fullName = sourceContextValue.ToString().Trim('"'); // remove quotes
|
||||
var fullName = sourceContextValue.ToString().Trim('"');
|
||||
var shortName = fullName.Split('.').Last();
|
||||
var shortContext = propertyFactory.CreateProperty("ShortSourceContext", shortName);
|
||||
logEvent.AddPropertyIfAbsent(shortContext);
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
{
|
||||
"Name": "Console",
|
||||
"Args": {
|
||||
"outputTemplate": "[{Level:u3}] {Timestamp:MM-dd HH:mm:ss} [#{ThreadId}] {ShortSourceContext:l} {Message:lj}{NewLine}{Exception}"
|
||||
"outputTemplate": "[{Level:u3}] {Timestamp:MM-dd HH:mm:ss} [#{ThreadId}] {ShortSourceContext:l}: {Message:lj}{NewLine}{Exception}"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user