I can not understand - like doing everything right. But for some reason, the .NET Core writes messages of the Information level. Although I clearly indicated in the settings to write only Error . Here is part of Program.cs :

 public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .ConfigureLogging((hostingContext, logging) => { logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); }) .Build(); 

The appsettings.json looks like this:

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

What am I doing wrong?

  • And if you try to set (you can even without appsettings.json ) just .ConfigureLogging(logging => logging.SetMinimumLevel(LogLevel.Error)) ? - Vadim Ovchinnikov
  • Vadim Ovchinnikov, I tried your version, and alas, it doesn’t help either, it’s some kind of mysticism, I’ve copied all the code related to the logs from this project to another project and everything’s ok, and then some trouble .. - Vasya Milovidov
  • Maybe this is due to the fact that in this project I have an Mvc service and in another project it is based on an empty template? - Vasya Milovidov
  • @VasyaMilovidov This is apparently some kind of problem with the project and it is not related to the code provided. - Vadim Ovchinnikov

1 answer 1

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

From where this file and who created it is not clear.