Multiple Formatters For 1 Log File?

Topics: Logging Application Block
Apr 23, 2010 at 5:05 AM

Hi,

I was trying to create a log file where based on the category it would give you more or less information. For example an error would be very detailed. 

So i added 2 Flat File Trace Listeners with the same path to the log file  and assigned a formatter for each. What seems to be happening though is an extra log file with a GUID appended to the name is being created. 

Is it possible to do what i am trying?

Apr 23, 2010 at 6:13 AM

That is the behavior when 2 trace listeners are trying to access the same file at the same time.  A way around this is to use an MSMQ trace listener to log to a message queue and then use the distributor service to pick up those message queues and it will be responsible for logging them to the location you want.

Link on how to use the Distributor Service - http://msdn.microsoft.com/en-us/library/cc511849.aspx

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com