C#C
C#3y ago
Simon

❔ Fire and forget, do I need a new logger?

I'm working on a small fire & forget background task initiated from asp.net. Essentially following this: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/best-practices?view=aspnetcore-6.0#do-not-capture-services-injected-into-the-controllers-on-background-threads
I am creating a new scope & requesting a new dbcontext.
The question I have is: I want to do some logging as well, do I need to request a new ILogger/ILoggerFactory from the scope.ServiceProvider or can I use the ILogger that is DI'd to the Controller?
Was this page helpful?