-
Notifications
You must be signed in to change notification settings - Fork 829
Description
Description
Serilog currently only supports case sensitive matches when overriding the log level for a specific namespace, when for example using Serilog with Serilog.Settings.Configuration and setting env variables for a docker image the Namespaces can't be all upper case.
Reproduction
Setting up a test project with Serilog and Serilog.Settings.Configuration installed, configure Serilog for example like this:
host.UseSerilog((context, configuration) =>
{
configuration
.WriteTo.Console(new JsonFormatter())
.ReadFrom.Configuration(context.Configuration);
})
add a appsettings file with the following configuration:
"Serilog": {
"Using": [ "Serilog.Sinks.Console" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Test.Nmspc": "Information"
}
},
"WriteTo": [
{ "Name": "Console" }
],
"Enrich": [
"FromLogContext"
],
"Properties": {
"Application": "Org.Eclipse.TractusX.Portal.Backend.Administration.Service"
}
},
Then execute the application with the following env var: SERILOG__MINIMUMLEVEL__OVERRIDE__TEST.NMSPC=Debug
The minimum logLevel for Loggers within that namespace will be Information
If needed I can provide an example repo.
Expected behavior
The minimum log level for logger instances creates within the Test.Nmspc Namespace should be Debug.
Relevant package, tooling and runtime versions
- Serilog 3.0.1
- Serilog.Settings.Configuration 3.4.0
- aspnet core 6 & 7 (both tested)
- docker image with environment variables (tested locally with a secret file as well on a win 10 machine)
Additional context
I've already provided a PR with a change for the case insensitive check.