serilog / serilog-extensions-logging

Serilog provider for Microsoft.Extensions.Logging

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Minimum Logging Level Question

kentonbmax opened this issue · 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" } },

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

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

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 can you provide a minimal example that reproduce the problem?