Choose enabled categories by thread without affect others

Topics: Enterprise Library Core, Logging Application Block
Nov 23, 2014 at 12:35 AM
Edited Nov 23, 2014 at 12:35 AM
Hi Guys,

Could you please help me in one stuff?

In EntLib 5, How can I Choose enabled categories by thread without affect others?

For instance:
FIRST THREAD - Enable Verbose and Error categories
SECOND THREAD - Enable Verbose category
THIRD THREAD - Enable Error category

The problem was I tried edit in runtime the TraceSources Object by removing/creating categories per thread but, of course, I was affecting other threads behavior.

Do you have any suggestion so that workaround this issue?

I appreciate your support!

Best Regards,
Nov 23, 2014 at 3:25 AM
As you found out, in general there is really just one configuration that is used the block. The usual approach for separate logging behavior per thread is to programmatically configure a separate LogWriter for each thread. This will work for thread-safe trace listeners (e.g. EventLog, database) or if writing to file based trace listeners where each thread writes to a separate log file.

Can you expand on the specifics of the behavior you wish to see?

Randy Levy
Enterprise Library support engineer
Support How-to