Runtime log file name

Topics: Logging Application Block
Apr 29, 2010 at 9:15 PM
I am using RollingFlatFile trace listener that writes to xxx.log. When several processes start, EntLib prepends the file name with some random guid string. I need to be able to open current log in, say Notepad. Is there a way to retrieve the name of the file that is currently being written to by the trace listener? Another option, is there a way to use process Id to customize the log file name? Thank you Alex
Apr 29, 2010 at 9:18 PM
Clarification: I am using EntLib 4.1
Apr 30, 2010 at 2:04 AM

The creation of new file appended with a guid is due to the fact that 2 or more trace listeners are trying to access the same file.  A workaround for this is to use the MSMQ Distributor Service.  Basically, you would configure your app to write to a message queue and then the Distributor Service will be responsible for distributing those logs from the queue to the destination you want.  Here's the link on how to use the Distributor Service -

"Another option, is there a way to use process Id to customize the log file name?" - Using the out-of-the-box trace listeners, no, this isn't possible but you certainly can create a custom trace listener that does this.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.