Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why i can't to change log level for logging categories by config file?

It's my config file:

{
  "Logging": {
    "LogLevel": {
      "Console": "Critical",
      "Default": "Warning",
      "System": "Warning",
      "Microsoft": "Trace"
    }
  }
}

This code i use to load config file:

        hostBuilder.ConfigureLogging ( ( context, builder ) =>
        {
            builder.AddConfiguration ( context.Configuration.GetSection ( "Logging" ) );
            builder.AddConsole ( );
        } );

But it set an Information log level for categories: System, Microsoft and a Debug for Default. Where did i make a mistake?

like image 273
Nodon Avatar asked Nov 26 '25 18:11

Nodon


1 Answers

I found a mistake. There are two config files appsettings.json and appsettings.Development.json. And system use it in development mode.

like image 188
Nodon Avatar answered Nov 29 '25 07:11

Nodon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!