Log4net appender filename issue

Posted by JL on Stack Overflow See other posts from Stack Overflow or by JL
Published on 2010-05-14T10:39:45Z Indexed on 2010/05/14 10:44 UTC
Read the original article Hit count: 244

Filed under:

I have an appender setup like this

<appender name="Scheduler_Appender" type="log4net.Appender.RollingFileAppender">
   <file value="c:\temp\ApplicationLog.txt"/>
   <rollingStyle value="Date"/>
   <datePattern value="yyyyMMdd"/>
   <appendToFile value="true"/>
   <staticLogFileName value="true"/>
   <layout type="MinLayout">
    <locationInfo value="true"/>
   </layout>
</appender>

When the log file first gets created the file name is simply ApplicationLog.txt this is correct.

However when the logging rolls - the filename that gets generated is ApplicationLog.txt20100323 (for example), and not ApplicationLog20100323.txt

How can I change the configuration so files are rolled to [FileName][Date].[ext] rather than [FileName].[ext][Date]

Thanks

© Stack Overflow or respective owner

Related posts about log4net