通过企业库滚动日志文件 [英] Rolling log file through Enterprise Library
本文介绍了通过企业库滚动日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好b $ b
如何通过企业库每天创建一个新的日志文件。
当我上网时,我发现rollinterval选项是指定哪个将允许您根据指定的值(时间间隔)创建文件。
但我想知道它是如何实现的。
如果我知道是否任何其他选项可用
Hi
How can i create a new log file everyday through enterprise library.
When i was surfing the net, I found rollinterval option to be specified which will allow you to create the file based on the value(interval of time) specified .
But I want to know how is it implemented.
Let me know if any other options are available
推荐答案
检查以下配置。你需要设置
rollFileEsistBehaviour =增量
rollInterval =日
rollSizeKB =文件的最大大小,之后新文件将创建
timeStampPattern =dd-MM-yyyy - 文件名模式
Check below configuration. You need to set
rollFileEsistBehaviour="Increment"
rollInterval="Day"
rollSizeKB="Maximum size of file after which new file will be created"
timeStampPattern="dd-MM-yyyy" - file name pattern
<loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General">
<listeners>
<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" footer="-[END]---------------------------------------" formatter="Text Formatter" header="-[START]---------------------------------------" rollFileExistsBehavior="Increment" rollInterval="Day" rollSizeKB="1000" timeStampPattern="dd-MM-yyyy" fileName="c:\Logs\Applicationlogs.log" />
</listeners>
</loggingConfiguration>
这篇关于通过企业库滚动日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文