-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with Serilog's RequestLogging and Rethrow #190
Comments
Hi @ismaelbl! 👋🏻 I don't understand what the issue is. You've configured the middleware to rethrow |
Hi @khellang. The problem it seems the same described in #104. The actual logging works fine, but it should just write this part:
The entry below the first one seems to be produced by the aforementioned issue. |
#104 is a completely different issue. The issue was that even though the exception was rethrown, the response ended up being empty. |
Ok, I thought it might have to do with the other issue because it's printting the Sorry if it's not the case, does it occur to you what could be happening? Thanks. |
It's hard to say what's happening as the code is incomplete and I don't know what the response looks like. To me, it looks like the request logging and problem details middleware are doing what they're supposed/configured to. |
Yes, it actually working as I spected, but for some reason it's printting two times the same exception. In the last one without the intervention of request logging. I will try to dig up more information next week. |
Hi, there. In the end the problem was caused by Serilog request logging. I solved it following serilog/serilog-aspnetcore#270. Instead of rethrowing the exception I set it via |
Good approach. I faced a similar issue and came up with a small library containing trivial middleware that sets exceptions in |
Continuing the issue described here #104.
I have the configuration below in my Startup class:
Here it's my ProblemDetails configuration. I just want to Rethrow unhandled exceptions that I want to log.
If I force and Exception in and endpoint I get the text belog in my log file. It's seems the same problem described in #104 still persists in v6.5.1.
The text was updated successfully, but these errors were encountered: