serilog / serilog-extensions-logging

Serilog provider for Microsoft.Extensions.Logging
Apache License 2.0
307 stars 97 forks source link

Minimum Logging Level Question #175

Closed kentonbmax closed 9 months ago

kentonbmax commented 4 years ago

Hi does this extension use the default logging level or do you need to provide it? Finding that it does not seem to use this in aspnet core etc.

ex. "Logging": { "LogLevel": { "Default": "Warning", ** use this? "System": "Warning", "Microsoft": "Warning" } },

kentonbmax commented 4 years ago

I wanted to to add that for Azure functions its the function name that sets the level, however; there is also a default option.

skomis-mm commented 4 years ago

Hi @kentonbmax ,

To be able to use Microsoft.Extensions.Logging filters you need to put Serilog sub-section:

"Logging": {
  "Serilog": {
     "LogLevel": {
        "Default": "Warning",
        ...
    }
 }

and configure Serilog like this:

var logger = new LoggerConfiguration()
       .MinimumLevel.Verbose()
       ...
       .CreateLogger();

or completely replace Serilogs configuration via Serilog.Settings.Configuration package

kentonbmax commented 4 years ago

Tried copied your example and tried to get it to work a few ways, but I still get Debug events logged to my sink.

skomis-mm commented 4 years ago

@kentonbmax can you provide a minimal example that reproduce the problem?

nblumhardt commented 9 months ago

Hi, sorry we couldn't answer your question here; if you're still looking for information on this, tagging a Stack Overflow post with the serilog tag will get the right eyes onto it. Hope this helps!