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
Is your feature request related to a problem? Please describe the problem.
If using UseExceptionHandler() middleware and ExceptionHandlerOptions.ExceptionHandler to handle an exception, the exception is still logged as an Error with the message "An unhandled exception has occurred while executing the request."
This seems wrong - given the name of the middleware & the name of the delegate on the options, this is all about handling an exception, so seeing a log about an unhandled exception is surprising.
Don't log, so people don't have to workaround it. Application code can log it if needed. Perhaps the middleware could log it as an unhandled error, but only after it's given a chance to be handled.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Triage: We believe that having the log message here is the appropriate default. As you've already seen, you can disable this by setting your log level to None for Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
If using
UseExceptionHandler()
middleware andExceptionHandlerOptions.ExceptionHandler
to handle an exception, the exception is still logged as an Error with the message "An unhandled exception has occurred while executing the request."aspnetcore/src/Middleware/Diagnostics/src/ExceptionHandler/ExceptionHandlerMiddlewareImpl.cs
Line 115 in 6df6573
This seems wrong - given the name of the middleware & the name of the delegate on the options, this is all about handling an exception, so seeing a log about an unhandled exception is surprising.
This comes up from time to time and workarounds are given for how to remove it from logs e.g. https://stackoverflow.com/questions/59553325/prevent-microsoft-logging-from-log-when-unhandled-exception-thrown
Describe the solution you'd like
Don't log, so people don't have to workaround it. Application code can log it if needed. Perhaps the middleware could log it as an unhandled error, but only after it's given a chance to be handled.
Additional context
No response
The text was updated successfully, but these errors were encountered: