I am pretty new to .Net Core. And I'm working on basic logging of information by the default ILogger provider. Initially my AppSetting.json was uncommented and able to see the logs that I've written.
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"AllowedHosts": "*"
}
Later, I commented theLogLevel properties and ran the application on Krestel server. Then I can still see the logged information in the console.
AppSettings.json
{
"Logging": {
//"LogLevel": {
// "Default": "Debug",
// "System": "Information",
// "Microsoft": "Information"
//}
},
"AllowedHosts": "*"
}
Program.cs
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureLogging((context, logging)
=>
{
logging.ClearProviders();
logging.AddConfiguration(context.Configuration.GetSection("Logging"));
logging.AddConsole();
})
.UseStartup<Startup>();
Sample logging method in HomeController.cs
public void LogExceptionToConsole()
{
_logger.LogError("This is raised by logger information");
}
Console
Why is this behavior? If this the behavior why it has been designed like this? Could anyone explain me.
Thanks in advance

appsettings.development.json- Ryan