2
有没有办法让我的当前日志文件始终具有timestamppattern?企业库日志记录5 - 滚动平面文件
这里是我的日志文件的监听器从app.config中
<add name="Exception" 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="%APPDATA%\MyProgram\Logs\exception.log" formatter="PrismText"
rollFileExistsBehavior="Increment" rollInterval="Day" timeStampPattern="yyyy-MM-dd" rollSizeKB="3000"
maxArchivedFiles="10" />
现在,一旦我打的最大大小或日期的变化,它重命名日志,但有一个方法可以让我获得初始日志文件显示TimeStamp模式?
我得到这个在我的日志文件夹中:
exception.log <-- Current log
exception.2011-12-22.1.log
exception.2011.12.22.2.log
我想这一点:
exception.2011-12-22.log (or exception.2011-12-22.1.log) <-- Current Log
exception.2011.12.22.2.log
它不是一个大问题,我可以只看修改/创建日期,但如果能够快速修复,这将是一件好事。
我不认为这是开箱即可100%可能。我确实看到了一个Kludge环境变量,其中涉及每日应用程序重新启动。如果你确实想要这个功能,你可以创建自己的RollingFlatFileTraceListener版本,这样就可以实现这种功能。 – 2011-12-30 03:33:35
我没有找到解决方案,我打算制作我的。 – lollancf37 2012-01-26 15:02:39