Hi @simplify3000 ,
why the values for LogLevel in Microsoft.Extensions.Logging, do NOT match those in Microsoft.ApplicationInsights.DataContracts
They are two different packages, to the Microsoft.ApplicationInsights.DataContracts.SeverityLevel, it is used by ExceptionTelemetry and TraceTelemetry to identify severity level. And the LogLevel Enum defines logging severity levels.
From your code and description, I assume you want to enable Application Insights for an ASP.NET Core application and collect logs, right?
If that is the case, you should use the following package in the Asp.net Core application:
- Microsoft.ApplicationInsights.AspNetCore (ASP.NET Core 3.1 requires Application Insights 2.8.0 or later.)
- Microsoft.Extensions.Logging.ApplicationInsights
- Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel
Then, it will use the Microsoft.Extensions.Logging.LogLevel
to set the log level.
More detail information about using Application Insights with Asp.net Core application, see:
Application Insights for ASP.NET Core applications
Application Insights logging with .NET
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards,
Dillion