Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.0.8
-
None
-
None
-
Windows 7/10
Windows application using log4net
Description
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".log""/>
<param name= "RollingStyle" value= "Date"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{HH:mm:ss.fff} [%t] {%-5level} [%logger] - %message%newline"/>
</layout>
</appender>