Best way to dispatch logs to different log files based on a "key"

Topics: Logging Application Block
Oct 25, 2013 at 8:52 AM
I'm using EntLib 6 to log to multiple filenames based on strings I get from my business layer.

Effectively, they call my function with LogIt(LogIdentifierString, Message)

I want to take the LogIdentifierString and log it to a different file. I can write code to hold onto say a dictionary of objects. I just don't know what the best way is.

All code I've read says I have hold onto the LogWriter classes. Is this the best way?

Also, I want to write them to each of their rolling log file names
Oct 25, 2013 at 6:50 PM
This thread has an example that logs to different files based on a dynamic value (which it uses to create a new category associated with each log file): .

I think that should help you. You would just need to use a rolling listener as opposed to flat file.

Randy Levy
Enterprise Library support engineer
Support How-to