Choosing the log to write in...

Topics: Logging Application Block
Aug 25, 2009 at 8:22 PM

I'm new to EntLib, I was wondering if there was a way by configuring TraceListeners/write code to write log to listener X depending on the sender.

I don't know if I can explain what I try to acheive, so here's an example :

If the log.write command comes from the communication module write log to comm.log

If it's from the data access module, write to data.log

and so on...


Help/Examples/Comments/Workarounds/Ideas are all welcomed,



Aug 25, 2009 at 11:32 PM

Sort of.  I would recommend creating Category Sources for each of your domains (comm, data access, etc) and then setting the category in your call to Logger.Write.

Additoinally, a LogEntry can be associated with more the one Category.



Aug 31, 2009 at 3:36 PM

Yay! It works perfectly, thanks for your help.