企业公司库滚动平面文件不滚动 [英] Entreprise Library Rolling flat file is not rolling

查看:102
本文介绍了企业公司库滚动平面文件不滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想旋转的日志文件,每星期之一,这个配置文件是行不通的。如果我把它改为只记录旋转,而不是午夜分钟一分钟时间一个单一的文件。正在生成没有新的文件。有没有组成,专注于滚动平面文件不工作ENTREPRISE库的最新版本的任何已知的bug?是否与我目前的配置中的任何问题?
谢谢

I'm trying to rotate log files, one per day of week and this configuration file is not working. If I change it to rotate instead of midnight to minute it only records one single file with one minute duration. No new files are being generated. Are there any known bugs of the latest version of entreprise library that focus on rolling flat files not working? Is there any problem with my current configuration? Thank you!

<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General"
    revertImpersonation="false">
    <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"
    fileName="C:\EMS\logs\MobileMessagingServices.log" footer="" formatter="Text Formatter"
    header="" rollFileExistsBehavior="Increment" rollInterval="Midnight"
    rollSizeKB="100000" timeStampPattern="yyyy-MM-dd hh:mm:ss" maxArchivedFiles="7"
    traceOutputOptions="Timestamp, Callstack" filter="All" />
</listeners>
<formatters>
  <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    template="{timestamp} :: {category} :: {message}" name="Text Formatter" />
</formatters>
<categorySources>
  <add switchValue="All" name="General">
    <listeners>
      <add name="Rolling Flat File Trace Listener" />
    </listeners>
  </add>
</categorySources>
<specialSources>
  <allEvents switchValue="All" name="All Events">
    <listeners>
      <add name="Rolling Flat File Trace Listener" />
    </listeners>
  </allEvents>
  <notProcessed switchValue="All" name="Unprocessed Category">
    <listeners>
      <add name="Rolling Flat File Trace Listener" />
    </listeners>
  </notProcessed>
  <errors switchValue="All" name="Logging Errors &amp; Warnings">
    <listeners>
      <add name="Rolling Flat File Trace Listener" />
    </listeners>
  </errors>
</specialSources>



推荐答案

好不容易才瑞普这一点。

Managed to repro this.

看来你的问题是时间戳格局。您可以使用冒号(:)作为分和秒的分隔符;当时间戳被串连到的文件名,该名称不获取例外如结肠是保留的字符内。你看不到的错误,因为你的'错误'的特殊源也配置为使用滚动平面文件跟踪监听器。

It appears your problem is in the timestamp pattern. You use colon (:) as a delimiter for minutes and seconds; when the timestamp gets concatinated to the file name, that name doesn't get excepted as the colon is a reserved charcter. You don't see the error, since your 'errors' special source is also configured to use the Rolling Flat File Trace Listener.

空间替换冒号,破折号,下划线或任何其它字符是有效的文件名,一切都将正常工作。此外,考虑配置的错误类别单独的侦听器。

Replace colon with space, dash, underscore or any other character which is valid for a file name and everything will work. Also, consider configuring a separate listener for the errors category.

此外,由于您选择了rollFileExistsBehavior =增量,而不是覆盖,它会增加一个后缀.1每个文件。后缀不会增加,因为你会得到一个新的文件,每一秒。您可能需要从时间模式去除SS或改变rollFileExistsBehavior。

Also, since you chose rollFileExistsBehavior="Increment" and not "Overwrite", it will add a .1 suffix to each file. The suffix will not increment, since you are going to get a new file every second. You may want to remove ss from the time pattern or change the rollFileExistsBehavior.

这篇关于企业公司库滚动平面文件不滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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