We are using log4net to create our logfiles from Windows services, and we are using the RollingFileAppender rolling based on date. The version of log4net we are using is 1.2.9. Now for the issue. We are rolling based on date, and on the days we need to restart a service the log file for that day is not rolled.
Example: Say today is November 16th. I have logfile.txt that contains today's information, and I have logfile.txt.20091115, logfile.txt.20091112, and logfile.txt.20091111. I am missing the files from 11/13 and 11/14 because the service was restarted on both of those days.
As anyone else experienced this or know why this is happening?
Update:
Here is my log4net.config appender section
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="logfile.txt" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="10" />
<param name="MaximumFileSize" value="1000KB" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="yyyyMMdd" />
<param name="StaticLogFileName" value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Service Started] " />
<param name="Footer" value="[Service Stopped] " />
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
As you can see the AppendToFile param is set to true.
I want to clarify something. The file does not get overwritten at the time I restart the service. When the file is suppose to roll based on date, is when the file disappears.