GUID append to log file in enterprise library logging RRS feed

  • Question

  • Hi

    I’m facing an issue when write the log entries to a single log file through multiple orchestrations running on different host instances. For each instance generate a new log file prepend with GUID. I’m using version 3.0 of enterprise library logging application block.

    Eg: if my log file name is “MyApp.log” then it generate “ [GUID]MyApp.log”

    This happen due to different app domain I guess. But I need to clarify is there a way to solve this issue and how this solve in log4net.


    Sunday, May 23, 2010 6:59 AM

All replies

  • The RollingFlatFileListener is based on the the .NET Framework's TextWriterTraceListener, which defines this prefixing behavior: "If an attempt is made to write to a file that is in use or unavailable, the file name is automatically prefixed by a GUID."

    You can either define your own trace listener that doesn't keep the file open (for guidance on how to write custom trace listeners see Lab 2 of the EntLib extensibility hands-on labs), or use the distributor service and write to the file in a single place; for the latter you'll need to set up MSMQ.

    Saturday, January 21, 2012 4:48 AM
  • There seems to be an alternate behavior here. I am testing a Microsoft service using the RollingFlatFileListener, and when pointed to a local folder, it NEVER creates files with the GUID prefix (which implies that this service does not create multiple instances attempting to write to the same log file).

    As soon as I point it to a network folder, it doesn't even attempt to create a file without a GUID prefix. The service account has full privileges to the target network share and NTFS folder, but it creates a single file with a GUID prefix in an empty folder, so it clearly is not adding the prefix due to "an attempt made to write to a file that is in use or unavailable".

    Friday, November 8, 2019 3:04 PM