You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when using the TraceTelemetryConverter, if a log message contains an exception it is logged to AI as an ExceptionTelemetry, otherwise as a TraceTelemetry. At least in our scenario, we don't really differentiate that much between exceptions and other errors, they must all be handled adequately. The current approach means that all our queries must start with exceptions | union traces, and must also account for the data in the tables being different (for example the message in exceptions is the exception message, not the logged message).
When an exception is logged as a trace, it should have customData["exception"] = exception.ToString() (or something)
It would probably also be useful for someone to have the options LogExceptionsAs = "Exceptions" (default) | "Traces" | "Both"
Application Insights itself seems to allow this with
Another workaround is not passing the Exception into the logger.Error call and just the error message string. But then we would lose the stack and Sonar scan will complain about exception not passing in etc.
Describe your suggestion
Currently, when using the TraceTelemetryConverter, if a log message contains an exception it is logged to AI as an ExceptionTelemetry, otherwise as a TraceTelemetry. At least in our scenario, we don't really differentiate that much between exceptions and other errors, they must all be handled adequately. The current approach means that all our queries must start with
exceptions | union traces
, and must also account for the data in the tables being different (for example the message in exceptions is the exception message, not the logged message).When an exception is logged as a trace, it should have
customData["exception"] = exception.ToString()
(or something)It would probably also be useful for someone to have the options
LogExceptionsAs = "Exceptions" (default) | "Traces" | "Both"
Application Insights itself seems to allow this with
Describe alternatives you've considered
My current workaround is to write my own TelemetryConverter
This works, but it seems to me that this is a feature that would make sense to have built-in.
The text was updated successfully, but these errors were encountered: