Open
Description
Hello guys, In my blazor server app i would like to Inject some scoped services in my logger to trace some client information like circuitId (or other scoped data which allow me to identify the client). Otherwise it will be a mess in my logs, I will not be able to attach an exception to a specific client.
I already read here its a bad idea to have a scoped logger, however i really need this features, so i try with this :
services.AddScoped<ILogger, MyLogger>();
services.Add(ServiceDescriptor.Scoped(typeof(ILogger<>), typeof(MyLogger<>)));
However i have this error at startup
Cannot resolve scoped service 'Microsoft.Extensions.Logging.ILogger`1[Microsoft.AspNetCore.Hosting.WebHost]' from root provider.'
So the question, is it something can be achieved now ? (even if its dirty) or there is no way i can retrieve scoped information from the logger ?
thanks !