serilog-extensions-logging icon indicating copy to clipboard operation
serilog-extensions-logging copied to clipboard

Minimum Logging Level Question

Open kentonbmax opened this issue 4 years ago • 4 comments

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 avatar Jun 10 '20 20:06 kentonbmax

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

kentonbmax avatar Jun 10 '20 20:06 kentonbmax

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

skomis-mm avatar Jun 12 '20 12:06 skomis-mm

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

kentonbmax avatar Jun 15 '20 18:06 kentonbmax

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

skomis-mm avatar Jun 16 '20 07:06 skomis-mm

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!

nblumhardt avatar Oct 03 '23 04:10 nblumhardt