I'm trying to get the log4net RollingFileAdapter working so that my logfiles are rolling over by date. However I'm finding that even when I copy the example code, I'm not getting the behaviour I expect. Instead of getting a single file of today's date and time, it splits the log messages between two different files. One file is called just "log" and the second one obeys the config and will be called 'log20130830-1115.txt'.
If I use <log4net debug="true">
in my config file, I see the folling in the Trace output:
log4net: Initial roll over to [c:\inetpub\wwwroot\QuartzTest\ScheduleTest\bin\Debug\log20130830-1115.txt]
log4net: Moving [c:\inetpub\wwwroot\QuartzTest\ScheduleTest\bin\Debug\log] -> [c:\inetpub\wwwroot\QuartzTest\ScheduleTest\bin\Debug\log20130830-1115.txt]
Notice line two... Why does it create a file called "log" in the first place? And why doesn't it seem to do the move it talks about? The entries in 'log' are always timestamped AFTER any of the entries in the correctly named file, even though that file appears first.
What's happening here? Have I messed up the config or is there a bug in the log4net RollingFileAppender?
Here is my config:
<log4net debug="true">
<appender name="TraceAppender" type="log4net.Appender.TraceAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[log4net] %d [%t] %-5p %l - %m%n" />
</layout>
</appender>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd-HHmm'.txt'" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="TraceAppender" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>