RollingFileAppender not working correctly when using DatePattern containing >= 
1 uppercase character in date format string literal
----------------------------------------------------------------------------------------------------------------------------------

                 Key: LOG4NET-291
                 URL: https://issues.apache.org/jira/browse/LOG4NET-291
             Project: Log4net
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 1.2.10, 1.2.9, 1.2.11
         Environment: N.A.
            Reporter: Lee Chun Kit
            Priority: Minor


When using RollingFileAppender with a DatePattern containing at least 1 
uppercase character in the form of a string literal, rolling of log files does 
not take place correctly. This is as "curFileName" is a lowercase string.

To reproduce, see: 
http://mail-archives.apache.org/mod_mbox/logging-log4net-user/201104.mbox/%[email protected]%3E

Suggest change/fix to RollingFileAppender.cs:

1.2.9:
793c793
<                               if (! curFileName.StartsWith(baseFile + 
m_dateTime.Now.ToString(m_datePattern, 
System.Globalization.DateTimeFormatInfo.InvariantInfo)))
---
>                               if (! curFileName.StartsWith(baseFile + 
> m_dateTime.Now.ToString(m_datePattern, 
> System.Globalization.DateTimeFormatInfo.InvariantInfo).ToLower(System.Globalization.CultureInfo.InvariantCulture)))

1.2.10
816c816
<                               if (! curFileName.StartsWith(baseFile + 
m_dateTime.Now.ToString(m_datePattern, 
System.Globalization.DateTimeFormatInfo.InvariantInfo)))
---
>                               if (! curFileName.StartsWith(baseFile + 
> m_dateTime.Now.ToString(m_datePattern, 
> System.Globalization.DateTimeFormatInfo.InvariantInfo).ToLower(System.Globalization.CultureInfo.InvariantCulture)))

Trunk:
885c885
<                               if (! 
curFileName.StartsWith(CombinePath(baseFile, 
m_dateTime.Now.ToString(m_datePattern, 
System.Globalization.DateTimeFormatInfo.InvariantInfo))))
---
>                               if (! 
> curFileName.StartsWith(CombinePath(baseFile, 
> m_dateTime.Now.ToString(m_datePattern, 
> System.Globalization.DateTimeFormatInfo.InvariantInfo).ToLower(System.Globalization.CultureInfo.InvariantCulture))))

Work-about:
Don't use uppercase characters in the form of a string literal for 
RollingFileAppender.DatePattern.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to