Azure by Patrik

Understanding SeverityLevel in Application Insights

Application Insights uses a fixed enum called SeverityLevel with 5 levels: Verbose, Information, Warning, Error, and Critical.

When logging in .NET using ILogger, the log level (such as Debug, Information, or Error) is internally mapped to Application Insights’ SeverityLevel. However, the mapping isn’t one-to-one — and by default, you can lose detail.

SeverityLevel Mapping Overview

Application Insights uses this enum:

Application Insights SeverityLevel Typical .NET LogLevel
Verbose (0) Trace / Debug
Information (1) Information
Warning (2) Warning
Error (3) Error
Critical (4) Critical

Both Trace and Debug are treated as Verbose, which means they can’t be distinguished once sent to Application Insights.

 

Tip: Add LogLevel as a Custom Property

To retain the original LogLevel, consider using a TelemetryInitializer to add it manually — so you can later filter logs by both SeverityLevel and original LogLevel.

LogLevel
SeverityLevel
applicationinsights
telemetry

Comments