❔ 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?2 Replies
ILogger
s are singleton, so you should be fine to use the same oneWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.