-
Notifications
You must be signed in to change notification settings - Fork 25
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
ILogger for Controller is not correctly resolved #21
Comments
Hi @urajkovic - thanks for the report. I'm not sure how to approach this, I'm not up-to-date with the Autofac integration for ASP.NET Core 2, so would need some time to debug. Help/PRs welcome, if anyone's able to take a look. Thanks again! |
I've encountered the same problem when trying to use the Autofac serilog integration within an ASP.NET Core 2.1 application - when injecting the ILogger into a Controller,
I've put together a basic project that illustrates the problem: @alvaromarithompson/serilog-bug-sample |
The quickest workaround is to |
When I add ILogger parameter to regular class Worker it is resolved as instance with context Worker and errors are correctly logged with SourceContext set to Worker.
However, when ILogger is parameter of UserController it is resolved as instance without context. So error messages don't contain SourceContext.
API is .NET Core 2.0.
The text was updated successfully, but these errors were encountered: