Entlib 4.1 logging from windows apps to single file on network

Topics: Logging Application Block
Jul 30, 2010 at 11:02 AM


I have an app that is running on multiple machines. They all write log data to a single log file that is on a share that can be accessed by all machines.

I would expect all the logging data being gathered in 1 file; the one that I have specified. But it turns out that my file is indeed used and contains most of the data, but also a lot of other files are created in the format of [GUID]MyFilename.txt. I think the reason is that one of the applications locks the logfile and when others want to writo to it when locked a new file is created.

Is there a way to make sure that all the logging data is written to the single file?




Jul 30, 2010 at 11:11 AM

That behavior is inherent to .NET Framework's TextWriterTraceListener.  To get around this, EntLib ships with the  Distributor Service which is capable of distributing log entries to a central destination.  For information on how to use this, refer to this link.


Sarah Urmeneta
Global Techology & Solutions
Avanade, Inc.

Jul 30, 2010 at 11:27 AM

Thanx for the answer!

Unfortunatelly, It is very difficult (but not impossible) for me to install the distribution service on the production environment.

Are there any other solutions?


For example, I would expect the logfile to be release the moment the logentry has been written. In my case the logfile has been locked for 6 hours, which means the logfile is not release untill the application tha is responsible for locking is actually exited. That seems unnecessary....


Jul 30, 2010 at 10:50 PM

That is the way the underlying .NET trace listener works, and what the Entlib listener is built on top of.

Can you log into a database instead?