Configuration
Logging can optionally read Serilog settings from appsettings.json when AddCustomLogging receives an IConfiguration instance. The package always adds log-context enrichment and its custom asynchronous console sink; configuration can add or override extra Serilog behavior supported by Serilog.Settings.Configuration.
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
}TIP
This configuration is optional. AddCustomLogging always creates a Serilog logger with log-context enrichment and the package console formatter. Add the Serilog section only when the application needs to override levels or apply extra Serilog configuration from appsettings.json.
Fields
Serilog: object
Root section read by Serilog's configuration package.
Serilog:MinimumLevel: object
Controls the minimum log levels used by Serilog.
Serilog:MinimumLevel:Override: Dictionary<string, string>
Sets namespace-specific minimum levels.