serilog-aspnetcore
serilog-aspnetcore copied to clipboard
Do not log exception call stacks for cancellations in RequestLoggingMiddleware
Is your feature request related to a problem? Please describe.
When a client cancels a request the RequestLoggingMiddleware will log the stack trace of the TaskCanceledException.
Describe the solution you'd like
RequestLoggingMiddleware should not log exception strack traces for cancellations.
Describe alternatives you've considered Maybe make it configurable. But I can't see a reason why anyone would want stack traces for cancellations.
Additional context Related to #341 but not the same. You might want to log "real" exceptions but cancellation exceptions are always spam. This could be implemented in the same way as DeveloperExceptionPageMiddlewareImpl or ExceptionHandlerMiddlewareImpl implements it. It would be a good idea to also fix the status code for cancellations at the same time (related to #344).