使用EL 5.0的日志记录应用程序块,基于日期生成日志? [英] generate logs based on date using logging application block for EL 5.0?

查看:60
本文介绍了使用EL 5.0的日志记录应用程序块,基于日期生成日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用EL 5.0的日志记录应用程序块。我像下面那样定义了侦听器。

I am using logging application block for EL 5.0. I defined listener like below.

    <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

How can generate log file daily?. like today=Rsslog10182011.log tomorrow = Rsslog10182011.log?

推荐答案

如果使用滚动式平面文件跟踪侦听器,该侦听器每天将为您提供一个文件。

If you use a rolling flat file trace listener that will give you a file for each day. This is from EL 4.1 but it is the same for 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"/>

这篇关于使用EL 5.0的日志记录应用程序块,基于日期生成日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆