I'm using the Azure.Monitor.OpenTelemetry.AspNetCore
OTEL package to emit telemtry to Application Insights for an ASP.NET Core application (.NET 8).
Within Application Insights, I don't see the "Category" field that I would normally see for e.g. function apps. This field captures the category in ILogger<Category>
, so I find it extremely useful for identifying the code that emitted the log.
How can I make the package also include the logging category?
Packages:
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
Code:
logger.LogInformation("Fetched all users");
Application Insights:
I'm using the Azure.Monitor.OpenTelemetry.AspNetCore
OTEL package to emit telemtry to Application Insights for an ASP.NET Core application (.NET 8).
Within Application Insights, I don't see the "Category" field that I would normally see for e.g. function apps. This field captures the category in ILogger<Category>
, so I find it extremely useful for identifying the code that emitted the log.
How can I make the package also include the logging category?
Packages:
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
Code:
logger.LogInformation("Fetched all users");
Application Insights:
Share Improve this question edited Feb 16 at 13:23 marc_s 755k184 gold badges1.4k silver badges1.5k bronze badges asked Feb 16 at 11:32 ShuzhengShuzheng 14k29 gold badges116 silver badges227 bronze badges1 Answer
Reset to default 3This bug was fixed in Azure.Monitor.OpenTelemetry.Exporter
v1.4.0-beta.1.
This is included in Azure.Monitor.OpenTelemetry.AspNetCore
v1.3.0-beta.2, so upgrade the package reference (from v1.2.0) to:
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.3.0-beta.2" />
1.4.0-beta.1 (2024-07-12)
Bugs Fixed
- Added the
LogRecord.CategoryName
field to log and exception telemetry. Previously theCategoryName
field was omitted, which was inconsistent with expectedILogger
behavior, and with Application Insights classic behavior.
(#44754)
https://github/Azure/azure-sdk-for-net/blob/cd4482ea1ef034f9c875e8c85bcff6704677dc08/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/CHANGELOG.md?plain=1#L32