我使用了此配置,但始终将日期添加到当前文件('log.20130805.0.log')中。
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="Logs/logFile.log" />
<appendToFile value="true" />
<preserveLogFileNameExtension value="true" />
<rollingStyle value="Composite" />
<datePattern value=".yyyyMMdd" />
<maximumFileSize value="10MB" />
<countDirection value="1"/>
<maxSizeRollBackups value="-1" />
<staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
该配置的结果是:
log.20130805.0.log
log.20130805.1.log
log.20130805.2.log
log.20130805.3.log
我用 staticLogFileName = true 得到的是:
log.log
log.1.log
log.2.log
log.3.log
我想要的是:
log.log
log.20130805.1.log
log.20130805.2.log
log.20130805.3.log