How can I configure the log4net appender to log into the default log file name, and spawn log files when the current log file reaches its defined limit, but leave the existing spawned log files in tact.
Example (log appender logs to log.log
)
log.log log.1.log log.2.log
log.log reaches its size limit, what I want is that log.log gets renamed to log.3.log, instead of log.1.log (and log.1.log becomes log.2.log, and log.2.log becomes log.3.log).
I thought I could achieve this with the StaticLogFileName
property, but that does not seem to be the case.
Current appender:
<appender name="ContextLogAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\IAI\Logs\ContextLog\context_log.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="100" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true"/>
<PreserveLogFileNameExtension value="true" />
<layout type="log4net.Layout.PatternLayout">
<header value="%newline===[SOFTWARE STARTUP AT %date]===%newline" type="log4net.Util.PatternString" />
<footer value="%newline===[SOFTWARE SHUTDOWN]===%newline%newline" type="log4net.Util.PatternString" />
<conversionPattern value="%date{yyyy-MM-dd HH:mm:ss,fff} [%-5level][thread: %thread][%logger] %message%newline" />
</layout>
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="PRODUCTION" />
</filter>
</appender>