[
https://issues.apache.org/jira/browse/LOG4NET-486?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Simon Clark updated LOG4NET-486:
--------------------------------
Description:
Rolling file appender with 'maxSizeRollBackups' set to a positive number tries
to initialise by looking at existing log files to continue the rolling sequence
and set 'm_curSizeRollBackups' to its correct value but the base filename
format is wrong.
In method GetWildcardPatternForFile with m_preserveLogFileNameExtension true it
should construct a wildcard pattern but the 'baseFileName' is not enough to
fully identify the log file when 'datePattern' is also specified.
For example: -
With log files such as: -
MyLogFile_2015-10-27.1.log
MyLogFile_2015-10-27.2.log
the pattern created is 'MyLogFile.*.log'
The date pattern is missing and as a result no log files are found and
historical log files get overwritten rather than rolled over.
A quick fix I'm using is to remove the '.' from the literal ".*" in the
wildcard. This allows the OS to identify the log files. Later code makes a
fuller check of the exact log file format and therefore this may be safe but I
would think it needs more validation and testing to be sure this works under
all circumstances.
was:
Rolling file appender with 'maxSizeRollBackups' set to a positive number tries
to initialise by looking at existing log files to continue the rolling sequence
and set 'm_curSizeRollBackups' to its correct value but the base filename
format is wrong.
In method GetWildcardPatternForFile with m_preserveLogFileNameExtension true it
should construct a wildcard pattern but the 'baseFileName' is not enough to
fully identify the log file when 'datePattern' is also specified.
For example: -
With log files such as: -
MyLogFile_2015-10-27.1.log
MyLogFile_2015-10-27.2.log
the pattern created is 'MyLogFile.*.log'
The date pattern is missing and as a result no log files are found and
historical log files get overwritten rather than rolled over.
> Rolling File Appender with 'maxSizeRollBackups' and 'datePattern' does not
> detect existing logs initially
> ---------------------------------------------------------------------------------------------------------
>
> Key: LOG4NET-486
> URL: https://issues.apache.org/jira/browse/LOG4NET-486
> Project: Log4net
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 1.2.13
> Environment: Windows 8, Visual Studio 2013
> Reporter: Simon Clark
> Labels: appender, rolling
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Rolling file appender with 'maxSizeRollBackups' set to a positive number
> tries to initialise by looking at existing log files to continue the rolling
> sequence and set 'm_curSizeRollBackups' to its correct value but the base
> filename format is wrong.
> In method GetWildcardPatternForFile with m_preserveLogFileNameExtension true
> it should construct a wildcard pattern but the 'baseFileName' is not enough
> to fully identify the log file when 'datePattern' is also specified.
> For example: -
> With log files such as: -
> MyLogFile_2015-10-27.1.log
> MyLogFile_2015-10-27.2.log
> the pattern created is 'MyLogFile.*.log'
> The date pattern is missing and as a result no log files are found and
> historical log files get overwritten rather than rolled over.
> A quick fix I'm using is to remove the '.' from the literal ".*" in the
> wildcard. This allows the OS to identify the log files. Later code makes a
> fuller check of the exact log file format and therefore this may be safe but
> I would think it needs more validation and testing to be sure this works
> under all circumstances.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)