i am using asp.net core mvc and web api project
which has below version
<TargetFramework>netcoreapp2.2</TargetFramework>
i'm also using Microsoft.Extensions.Logging.ILogger to log some of information
for Example : _logger.LogInformation("special information log for xyz method"); for application insight.
so as per this post https://weblog.west-wind.com/posts/2018/Dec/31/Dont-let-ASPNET-Core-Default-Console-Logging-Slow-your-App-down
i made log level like this in my local app setting project and hit play icon from visual studio and watching console logs in black window.
"LogLevel": {
"Default": "Information",
"System": "Warning",
"Microsoft": "Warning"
}
now when i do run of my application, still i'm able to see logs like this
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 35782.1232ms 200 text/html; charset=UTF-8
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:57526/polyfills.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:57526/styles.js
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:57526/vendor.js
Question #1 : why still i'm able to to see this log in console window where "info is from Microsoft" :(
Question #2 : what is your best recommendation(experiences) log level for production and development? i do not want to slow down my application due to wanted to log information logged to application insights.
program.cs
// Optional: Apply filters to control what logs are sent to Application Insights.
// The following configures LogLevel Information or above to be sent to
// Application Insights for all categories.
logging.AddFilter<Microsoft.Extensions.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider>
("", LogLevel.Information);
}
}
);
