Closed
Description
Is your feature request related to a problem? Please describe.
Suppose an exception occurs on some path. When using app.UseSerilogRequestLogging()
it logs the normal template as well as the exception.
In our exception handler we already log the exception, therefore our logs show the exception twice.
I tried to override the template but that doesn't help:
app.UseSerilogRequestLogging(x => {
x.MessageTemplate = "HTTP {RequestMethod} {RequestPath} responded {StatusCode} in {Elapsed:0.0000} ms";
});
Describe the solution you'd like
A way to suppress logging the exception, if it occurs on the exception handling path, ie. /Error
.
Describe alternatives you've considered
Changing our exception handler, so it doesn't log the exception. But that makes no sense of course, because that's where it belongs..