In my test POST action am saving 4 different logs (Information, Warning, Error & Critical) into Windows EventLog. I can see all four in Event viewer but one of them has wrong level. It is marker as 'Error' but it should be marked as 'critical'
Program.cs
return Host.CreateDefaultBuilder(args)
.ConfigureLogging(logger =>
{
logger.ClearProviders();
logger.AddEventLog(new EventLogSettings
{
SourceName = "Website API",
LogName = "Website API"
});
})...
appsettings.json
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
},
"EventLog": {
"LogLevel": {
"Default": "Warning"
}
}
}
Controller
public async Task<IActionResult> TestEndPoint()
{
_logger.LogInformation("LogInformation");
_logger.LogWarning("LogWarning");
_logger.LogError("LogError");
_logger.LogCritical("LogCritical");
return Ok(null);
}
Application: REST API - .NET 5.0