❔ Configuring loglevel of injected ILogger

I'm attempting to configure the loglevel of a custom ILogger<T> through configuration. Is this easily possible? 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. "Error". However, I still see Warnings in my log sink. I've also attempted the fully qualified name, including namespace, but still no luck. I do use Serilog with Seq and Console sink right now, but got it hooked up to ILogger through the Serilog.Extensions.Logging package.
2 Replies
Sossenbinder
SossenbinderOP2y ago
Figured it out, I needed to switch to the SeriLog.MinimumLevel config section
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server