logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy Chastain (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (LOG4NET-203) RollingFileAppender does not roll more than one time when PreserveLogFileNameExtension is true
Date Sun, 11 Sep 2011 18:42:09 GMT

     [ https://issues.apache.org/jira/browse/LOG4NET-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Roy Chastain reassigned LOG4NET-203:
------------------------------------

    Assignee: 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
>            Assignee: Roy Chastain
>             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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message