Skip to content
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

cause 404 error if Loging happened from background thread. #10

Open
martinmani opened this issue Aug 19, 2019 · 2 comments
Open

cause 404 error if Loging happened from background thread. #10

martinmani opened this issue Aug 19, 2019 · 2 comments

Comments

@martinmani
Copy link

as this nuget uses HttpContextAccessor to get the http context properties, it cause 404 to next incoming request as the http-method becomes empty string.
please see aspnet/KestrelHttpServer#2591 for more details.

So instead of getting the properties at logging time it would be good idea to set the properties to LogContext in a middle ware so that HttpContextAccessor wont be accessed from a background thread.

@trenoncourt
Copy link
Owner

Hi,

Thanks for the catch.
Here is another package with middleware : https://github.com/trenoncourt/serilog-aspnetcore-middleware

@martinmani
Copy link
Author

thank you but this is directly logging the http request details. Not enriching the logger or log context.
I was looking for enrich the SeriLog Context so that if any part of code will log message with the request details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants