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

Register new Logger instance with DI #180

Open
cpkuo opened this issue Mar 10, 2020 · 2 comments
Open

Register new Logger instance with DI #180

cpkuo opened this issue Mar 10, 2020 · 2 comments

Comments

@cpkuo
Copy link

cpkuo commented Mar 10, 2020

If UseSerilog() is used to register a configured logger so that it resolves to Microsoft.Extensions.Logging.ILogger, then what is the recommended way to re-register it once the application is running and a new configured logger is used to replace the existing one? I am dynamically building a new logger since I also need to change source context overrides at any given point.

@nblumhardt
Copy link
Member

Hi! Check out https://github.com/nblumhardt/serilog-reload for an example project showing how this might be done. Still uncertain how/when this will be integrated into Serilog.AspNetCore, but considering it for .NET 5.

@nblumhardt
Copy link
Member

This is covered by: serilog/serilog-extensions-hosting#28

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

No branches or pull requests

2 participants