Log4net RollingFileAppender Size rollingStyle file extension
Posted
by BrettRobi
on Stack Overflow
See other posts from Stack Overflow
or by BrettRobi
Published on 2010-04-09T15:15:45Z
Indexed on
2010/04/11
0:23 UTC
Read the original article
Hit count: 1412
log4net
I am using the RollingFileAppender and the Size rollingStyle. By default it creates backup files with a numbered extension, this drives me nuts. Is it possible to change it so it always uses a defined extension (say .txt or .log) and inserts the number as part of the file name. For example:
myapp.log
myapp.1.log
myapp.2.log
myapp.3.log
Here is my current configuration:
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="myapp.log"/>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maximumFileSize value="1MB"/>
<maxSizeRollBackups value="10"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{ISO8601} [%3thread] %-5level %logger{3}: %message%newline" />
</layout>
</appender>
© Stack Overflow or respective owner