Skip to content

Microsoft.Extensions.logging events don't contain the real exception message under FormattedMessage event #43092

@puneetg1983

Description

@puneetg1983

We are enabling Microsoft.Extensions.Logging ETW events and collecting the ETW Trace using Perfview by following these steps

Then we create a Controller and throw an exception in that and capture the ETW events using PerfView and filter only on ExceptionHandlerMiddleware event and we see this.

Microsoft-Extensions-Logging/FormattedMessage 24,601.538 ThreadID="28,588" ProcessorNumber="0" Level="4" FactoryID="1" LoggerName="Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware" EventId="1" EventName="UnhandledException" FormattedMessage="An unhandled exception has occurred while executing the request." ActivityID="/#14688/1/6/"

The exception still shows under Message and MessageJson. Its missing only in FormattedMessage.

The expected behavior is that exception message still shows under FormattedMessage event so tools parsing the events can leverage this information.

Configuration

POST .NET Core 2.1

Regression?

This seems to be a regression after .NET Core 2.1. Prior versions of .NET Core used to have the real exception message under the FormattedMessage event but now all they contain is the string "An unhandled exception has occurred while executing the request"

Adding @maryamariyan as she can add more details if needed.

Metadata

Metadata

Assignees

Labels

area-Extensions-Loggingbugin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions