Log4net RollingFileAppender在过渡期间丢失文件 [英] Log4net RollingFileAppender losing files during rollover

查看:86
本文介绍了Log4net RollingFileAppender在过渡期间丢失文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个RollingFileAppender,它似乎在某些时候丢失了文件.
例如:我的日志文件夹中有以下日志文​​件

Hi,

I''ve a RollingFileAppender that appears to be loosing files at some point.
For example: I have the following log files in my log folder

applog.log.220
applog.log.221
applog.log.222
applog.log.224
applog.log.225


由于某些原因,缺少applog.log.223.当我查看222日志中的最后一条日志消息并将其与224日志中的第一条日志消息进行比较时,我发现缺少了几分钟.在某些情况下,可能只有5分钟到45分钟.
以下是我的配置:


For some reason, applog.log.223 is missing. When I look at the last log message in 222 log and compare it to first log message in 224 log, I see several minutes are missing. In some cases it would be as little as 5 minutes and as long as 45 minutes.
below is my config:

<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
      <param name="File" value="D:\Log Files\applog.log"/>
      <param name="AppendToFile" value="true"/>
      <param name="RollingStyle" value="Size"/>
      <param name="MaxSizeRollBackups" value="1000"/>
      <param name="MaximumFileSize" value="20MB"/>
      <param name="StaticLogFileName" value="true"/>
      <param name="CountDirection" value="1"/>
      <layout type="log4net.Layout.PatternLayout">
        <param name="ConversionPattern" value="%date  %-5p %25.25c [%x][%5thread] - %message%newline"/>
      </layout>
    </appender>


任何帮助将不胜感激.

Thanks


any help would be appreciated.

thanks

推荐答案

假定您没有使用AppDomains或多个进程来写入同一文件,则Log4net中存在此问题.不幸的是,上次我检查没有人似乎真的在支持该记录器.因此,您可能必须自己修复它.或切换到其他记录器.
Presuming that you are not using AppDomains or multiple processes to write to the same file then it is is a problem in Log4net. And unfortunately last time I checked no one really seemed to be supporting that logger. So you might have to fix it yourself. Or switch to a different logger.


这篇关于Log4net RollingFileAppender在过渡期间丢失文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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