I would like a new log file created everytime the application starts. If a log file already exists, I would like the existing one renamed. Is this possible? My current Listener entry looks like this
<add name="QueueDiagListener" 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="C:\Logs\QueueDiag.log" footer="" formatter="MessageOnlyFormatter"
header="" rollFileExistsBehavior="Increment" rollSizeKB="1024" />
What am i missing?
I’ve had the same issue numerous times. There doesn’t seem to be a way of solving this in a configurational manner. I always solve this issue in code in the wrapper class.
I’d recommend adding
timeStampPattern="yyyy-MM-dd"to your config. The code works without it’just easier to find the required log file.The code:
`
`
Hope this helps.