Skip to content

Send Exception/Trace Telemetry based on Log Level #2797

Open

Description

Is your feature request related to a problem?
The default ApplicationInsightsLogger implementation of ILogger sends every log message that contains an exception object as an exception telemetry. There is an option TrackExceptionsAsExceptionTelemetry, but it does not consider the log level. In Azure Portal, when displaying the transaction timeline, I would assume that exceptions indicate errors that caused the operation to fail. However, if I catch an exception in the code and log it on the Information or Debug or even Warning level, then this does not mean that the operation failed. When analyzing transactions in Application Insights, seeing an Exception would make me think that the operation has failed, whereas this is only true for logs on the Error or Critical Level.

Describe the solution you'd like.
I would like to be able to configure a log level threshold to decide whether an exception is sent as a trace or exception telemetry.

Additional context.
This issue was raised a while ago for the log4net appender but the feature request didn't get enough upvotes. This is still relevant for us: #1472

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions