Open
Description
Is your feature request related to a problem? Please describe.
If my application uses UseSerilogRequestLogging
all unhandled exceptions are logged twice. This causes logs to be more long/complicated than they need to be.
Describe the solution you'd like
RequestLoggingOptions
should have an option to not log the exception.
Describe alternatives you've considered
Maybe exception logging should even be disabled by default since I couldn't find any case where the exception isn't logged by something else.
Additional context
There are multiple other classes which already log the exception, depending on your middleware configuration:
- If you use
UseDeveloperExceptionPage
(or are running inDevelopment
hosting environment which enables this by default) then the exception is logged byMicrosoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware
. - If you use
UseExceptionHandler
then the exception is logged byMicrosoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware
. - If you use neither then the exception is logged by
Microsoft.AspNetCore.Server.Kestrel
.