Fix serilog not logging caller name
This commit is contained in:
parent
233ba3184f
commit
4ffe70af0e
@ -121,7 +121,7 @@ namespace AppScaffolding
|
|||||||
zipFileSink["Name"] = "File";
|
zipFileSink["Name"] = "File";
|
||||||
fileChanged = true;
|
fileChanged = true;
|
||||||
}
|
}
|
||||||
var hooks = $"{nameof(LibationFileManager)}.{nameof(FileSinkHook)}, {nameof(LibationFileManager)}";
|
var hooks = typeof(FileSinkHook).AssemblyQualifiedName;
|
||||||
if (serilog.SelectToken("$.WriteTo[?(@.Name == 'File')].Args", false) is JObject fileSinkArgs
|
if (serilog.SelectToken("$.WriteTo[?(@.Name == 'File')].Args", false) is JObject fileSinkArgs
|
||||||
&& fileSinkArgs["hooks"]?.Value<string>() != hooks)
|
&& fileSinkArgs["hooks"]?.Value<string>() != hooks)
|
||||||
{
|
{
|
||||||
@ -158,7 +158,8 @@ namespace AppScaffolding
|
|||||||
// - with class and method info: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] (at {Caller}) {Message:lj}{NewLine}{Exception}";
|
// - with class and method info: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] (at {Caller}) {Message:lj}{NewLine}{Exception}";
|
||||||
// output example: 2019-11-26 08:48:40.224 -05:00 [DBG] (at LibationWinForms.Program.init()) Begin Libation
|
// output example: 2019-11-26 08:48:40.224 -05:00 [DBG] (at LibationWinForms.Program.init()) Begin Libation
|
||||||
// {Properties:j} needed for expanded exception logging
|
// {Properties:j} needed for expanded exception logging
|
||||||
{ "outputTemplate", "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] (at {Caller}) {Message:lj}{NewLine}{Exception} {Properties:j}" }
|
{ "outputTemplate", "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] (at {Caller}) {Message:lj}{NewLine}{Exception} {Properties:j}" },
|
||||||
|
{ "hooks", typeof(FileSinkHook).AssemblyQualifiedName }, // for FileSinkHook
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,6 +27,7 @@ namespace LibationFileManager
|
|||||||
//https://github.com/serilog/serilog-settings-configuration/issues/406
|
//https://github.com/serilog/serilog-settings-configuration/issues/406
|
||||||
var readerOptions = new ConfigurationReaderOptions(
|
var readerOptions = new ConfigurationReaderOptions(
|
||||||
typeof(ILogger).Assembly, // Serilog
|
typeof(ILogger).Assembly, // Serilog
|
||||||
|
typeof(LoggerCallerEnrichmentConfiguration).Assembly, // Dinah.Core
|
||||||
typeof(LoggerEnrichmentConfigurationExtensions).Assembly, // Serilog.Exceptions
|
typeof(LoggerEnrichmentConfigurationExtensions).Assembly, // Serilog.Exceptions
|
||||||
typeof(ConsoleLoggerConfigurationExtensions).Assembly, // Serilog.Sinks.Console
|
typeof(ConsoleLoggerConfigurationExtensions).Assembly, // Serilog.Sinks.Console
|
||||||
typeof(FileLoggerConfigurationExtensions).Assembly); // Serilog.Sinks.File
|
typeof(FileLoggerConfigurationExtensions).Assembly); // Serilog.Sinks.File
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user