I'm attempting to configure the loglevel of a custom ILogger<T>
through configuration. Is this easily possible? I want to restrict logging for this specific handler without touching any general settings.
In my custom case I'm injecting an ILogger<DataHandledLoggingHandler>
into my class, and would like to disable it in certain environments. What I assumed should work is to add a key "DataHandledLoggingHandler" to the Logging.LogLevel section of appsettings.json, to e.g. "None". However, I still see Warnings in my log sink. My appsetting.Development.json would look like this:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"DataHandledLoggingHandler": "None",
}
...
I've also attempted the fully qualified name including namespace, but still no luck, logging still takes place.
I do use Serilog with Seq and Console sink right now, but got it hooked up to ILogger through the Serilog.Extensions.Logging package