serilog-settings-configuration
serilog-settings-configuration copied to clipboard
Correct way to make Serilog read Logging section from appsettings.json
What is the correct way to make Serilog read Logging
section from appsettings.json?
I want Serilog to count this section:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
The section you're showing is MEL's configuration section; Serilog has its own (under "Serilog"), there's no way to get Serilog to use MEL's (it's a different logging framework). Hope this helps
The section you're showing is MEL's configuration section; Serilog has its own (under "Serilog"), there's no way to get Serilog to use MEL's (it's a different logging framework). Hope this helps
Hey @nblumhardt , thanks for a fast response! Yes, I know that this section from MEL. Perhaps it costs to add some mapper that will grab Serilog configuration from Logging
section by default? It's really not expected behavior when after Serilog adding, Logging
section's configs became ignored.
Thanks for your reply @rodion-m. Unfortunately the systems aren't equivalent; the "Logging" section isn't generic - it's specific to the implementation-side of Microsoft.Extensions.Logging. Serilog only implements the MEL abstractions, and has a completely different internal model of levels, sinks, filters, etc.
Sometimes I had a desire to write such a mapper, but I quickly came to the conclusion that it was not worth it.