[英]generate logs based on date using logging application block for EL 5.0?
我正在使用EL 5.0的日志應用程序塊。 我定義了如下的監聽器。
<add name="FlatFile TraceListener" type="Microsoft.Practices.EnterpriseLibrary.
Logging.TraceListeners.FlatFileTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.
Logging.Configuration.FlatFileTraceListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging"
fileName="C:\Temp\RssLog.log" header="--------------"
footer="----------------------" formatter="Brief Format Text"
traceOutputOptions="None" filter="All" />
如何每天生成日志文件? 像今天= Rsslog10182011.log
明天= Rsslog10182011.log
嗎?
如果您使用滾動式平面文件跟蹤偵聽器,那么它將每天為您提供一個文件。 這是EL 4.1,但EL5也是如此。
<add fileName=".\Logs\exception.log" footer="" formatter="Trace Formatter" header="" rollFileExistsBehavior="Overwrite" rollInterval="Midnight" rollSizeKB="0" timeStampPattern="yyyyMMdd" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" traceOutputOptions="Callstack" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Exception TraceListener"/>
請嘗試使用滾動平面文件跟蹤偵聽器。 例如,你可以為初學者嘗試這個:
<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="RssLog.log"
rollFileExistsBehavior="Increment"
rollInterval="Midnight" />
您可以下載Enterprise Library 5.0文檔,以獲取有關配置滾動平面文件跟蹤偵聽器的更多詳細信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.