[
https://issues.apache.org/jira/browse/LOG4NET-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Roy Chastain reassigned LOG4NET-203:
------------------------------------
Assignee: (was: Roy Chastain)
> RollingFileAppender does not roll more than one time when
> PreserveLogFileNameExtension is true
> ----------------------------------------------------------------------------------------------
>
> Key: LOG4NET-203
> URL: https://issues.apache.org/jira/browse/LOG4NET-203
> Project: Log4net
> Issue Type: Bug
> Components: Appenders
> Environment: I'm using the trunk
> Reporter: Scott Alexander
> Fix For: 1.2 Maintenance Release
>
>
> Method InitializeFromOneFile in RollingFileAppender.cs does not take into
> account the file extension. To repro setup an appender like so
> var appender = new DevicePointValueCsvAppender
> {
> MaxFileSize =
> ConfigurationManager.AppSettings[MaxFileSizeName].IfNotNull(max =>
> OptionConverter.ToFileSize(max, DefaultMaxFileSize), DefaultMaxFileSize),
> MaxSizeRollBackups = 6,//
> ConfigurationManager.AppSettings[MaxSizeRollBackupsName].IfNotNull(max =>
> Int32.Parse(max), DefaultMaxSizeRollBackups),
> Layout = new PatternLayout { ConversionPattern =
> PatternLayout.DefaultConversionPattern },
> File = String.Format(CultureInfo.InvariantCulture,
> FileNameFormat, modbusMasterName),
> RollingStyle = RollingFileAppender.RollingMode.Composite,
> PreserveLogFileNameExtension = true,
> StaticLogFileName = false,
> AppendToFile = false
> };
> When the logger initializes the call to InitializeRollBackups is made whic
> incorrectly calculates the pre-existing number of backups, due to the fact
> that the file extension is being included in the following line
> if (! curFileName.StartsWith(CombinePath(baseFile,
> m_dateTime.Now.ToString(m_datePattern,
> System.Globalization.DateTimeFormatInfo.InvariantInfo))))
> The previous line should be replaced with something like the following
> string baseComparison = CombinePath(baseFile,
> m_dateTime.Now.ToString(m_datePattern,
> System.Globalization.DateTimeFormatInfo.InvariantInfo));
> if (m_preserveLogFileNameExtension)
> baseComparison =
> Path.GetFileNameWithoutExtension(baseComparison);
> if (! curFileName.StartsWith(baseComparison))
> Thanks
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira