Autofac registration - For user defined thread

102 views Asked by At

In our project, we have multiple threads running in parallel. SO for each customer we have respective thread for them. Currently we have an application level logging, using Serilog, where logs for all the threads are written into one folder. We are planning to change this to have the logs per customer in their respective folders.

The folder should be formed with CustomerId in their names and when a thread is created for a customer, it should be registered so that it can resolved during run time.

I tried registering in the Module that we have, but the issue is that we will not know the customer id at the time the module is being registered.

So basically my requirement is, we should have a logger instance per thread(user defined) and be able to use it in the other classes that follow or in other words, register the same component with respect to the different threads with the threadname or some other field like customerid.

Could anyone help me with how to register and resolve this at runtime?

Thanks!

0

There are 0 answers