You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But that line creates a rule that overwrites the logging configuration.
What is a proper way to use serilog with dotnet configuration rules? Should I simply avoid using AddSerilog method and call builder.AddProvider(new SerilogLoggerProvider(logger)) instead?
The text was updated successfully, but these errors were encountered:
Hi! Yes, working around this with AddProvider(new ...) is probably the way to go.
This is an unfortunate remnant of the original ".NET Core 2" iteration of this library, before we implemented the UseSerilog() (logger factory) method of integration. Back at that time, having two logging pipelines with level configuration both impacting the final result was problematic.
If I could go back in time :-), in "provider mode" I'd now avoid doing this, and just leave MEL's filters alone when using Serilog as a provider rather than as the complete logging pipeline.
Serilog 4 introduces a new public CreateSink() API that can instantiate any Serilog sink independently of the Serilog pipeline. I've been wondering whether this might be a good route to replacing the current provider mechanism with something based on e.g.:
Behind the scenes, this would use LoggerSinkConfiguration.CreateSink() to turn the argument into an ILogEventSink, and a SerilogSinkLoggerProvider would be wrapped around the result.
JSON configuration support is still a bit of an unknown, though, so needs some more investigation. Let's leave this ticket as the tracking issue.
Hello,
I would like to ask, what is the reason for this line
serilog-extensions-logging/src/Serilog.Extensions.Logging/SerilogLoggingBuilderExtensions.cs
Line 48 in 1e9f655
The thing is that I would like to use dotnet configuration for serilog as well, i.e. something like this
But that line creates a rule that overwrites the logging configuration.
What is a proper way to use serilog with dotnet configuration rules? Should I simply avoid using
AddSerilog
method and callbuilder.AddProvider(new SerilogLoggerProvider(logger))
instead?The text was updated successfully, but these errors were encountered: