You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Peter Xiao (JIRA)" <ji...@apache.org> on 2019/08/09 01:11:00 UTC

[jira] [Created] (LOG4NET-635) RollingFileAppender overwrite existing log file when system date update

Peter Xiao created LOG4NET-635:
----------------------------------

             Summary: RollingFileAppender  overwrite existing log file when system date update
                 Key: LOG4NET-635
                 URL: https://issues.apache.org/jira/browse/LOG4NET-635
             Project: Log4net
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.0.8
         Environment: Windows 7/10
Windows application using log4net
            Reporter: Peter Xiao


When system date change, log4net will create new log file base on rolling style.

But is new date's log file already exists, the content inside the log file will be overwritten when system date updated to the specific date.

 

For example: 

Current date is 2019-08-09, log file LoadABC2019-08-09.log was generated.

LoadABC2019-08-10.log already exists and there is content inside.

Once system date update to 2019-08-10, LoadABC2019-08-10.log is overwritten by log4net rather than append. (Application keep running during the system date updating)

 

This behaviors will cause log lost issue.

 

Below is the Appender config :

<appender name="LoadADV" type="log4net.Appender.RollingFileAppender">
 <param name= "File" value= "log\LoadABC"/>
 <param name= "AppendToFile" value= "true"/>
 <param name= "MaxSizeRollBackups" value= "30"/>
 <param name= "StaticLogFileName" value= "false"/>
 <param name= "DatePattern" value= "yyyy-MM-dd&quot;.log&quot;"/>
 <param name= "RollingStyle" value= "Date"/>
 <layout type="log4net.Layout.PatternLayout">
 <conversionPattern value="%date\{HH:mm:ss.fff} [%t] \{%-5level} [%logger] - %message%newline"/>
 </layout>
 </appender>

 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)