Reputation: 41
I'm using Microsoft Enterprise 5 Logging block. While testing locally all rolling flat files are created correctly and Database logging to my local instance of SQL logs as expected. The problem is when I publish my apps to the Test environment we have. Here it's when something strange happens: Logs files are created with strange GUID-like names.They eventually roll but it is very strange and it does that often. Also Databse logging does not happen either. I have not been able to find anything related to this issue online. I suspect Authentication issues when setting the App Pools and Folders in IIS but not sure. Does anyone has this problem? Here's my configuration settings:
<add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
fileName="D:\logs\MobileApps\rolling.log" formatter="Text Formatter"
rollFileExistsBehavior="Increment" rollInterval="Hour" timeStampPattern="yyyy-MM-dd-hh" />
Files get names like
deb7f413-6cb3-44ac-900e-02883856e82bRolling.log
rolling.2012-01-19-09.log
Upvotes: 4
Views: 1896
Reputation: 4107
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 set of hands-on labs on EntLib extensibility), or use the distributor service and write to the file in a single place; for the latter you'll need to set up MSMQ.
Upvotes: 3