c# – How to set a different logging level in .NET Core


I can't figure it out, I'm doing everything right. But for some reason, .NET Core writes messages of the Information level to the logs. Although I explicitly specified in the settings to write only Error . Here is the part of Program.cs :

public static IWebHost BuildWebHost(string[] args) =>
        .ConfigureLogging((hostingContext, logging) =>

appsettings.json looks like this:

"Logging": {
  "IncludeScopes": false,
  "LogLevel": {
    "Default": "Error"

What am I doing wrong?


I figured it out… The reason was that the appsettings.Development.json file was in the application directory and the logging settings were taken from it and not from appsettings.json , and this file was not visible in the VisualStudio browser, and I didn’t even think to go myself to the application directory and see what's there.

Where this file comes from and who created it is unclear.

Scroll to Top