possible bugs in RollingFileAppender.cs causing failure to timly roll files on 
monthly or yearly intervals (and inappropriate error reports on yearly 
intervals).
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

         Key: LOG4NET-60
         URL: http://issues.apache.org/jira/browse/LOG4NET-60
     Project: Log4net
        Type: Bug
  Components: Appenders  
    Versions: 1.2.9    
    Reporter: Lanchon


code in said file looks like this

                                case RollPoint.TopOfMonth:
                                        current = 
current.AddMilliseconds(-current.Millisecond);
                                        current = 
current.AddSeconds(-current.Second);
                                        current = 
current.AddMinutes(-current.Minute);
                                        current = 
current.AddHours(-current.Hour);
                                        current = current.AddMonths(1);
                                        break;

i belive it should look something like this

                                case RollPoint.TopOfMonth:
                                        current = 
current.AddMilliseconds(-current.Millisecond);
                                        current = 
current.AddSeconds(-current.Second);
                                        current = 
current.AddMinutes(-current.Minute);
                                        current = 
current.AddHours(-current.Hour);
                                        current = current.AddDays(1 - 
current.Day);      // this line seems to be needed
                                        current = current.AddMonths(1);
                                        break;



also in a separate issue, since there is no RollPoint.TopOfYear, this comment 
in another part of the code seems wrong:

                                //is the new file name equivalent to the 
'current' one
                                //something has gone wrong if we hit this -- we 
should only
                                //roll over if the new file will be different 
from the old
                                string dateFormat = 
m_now.ToString(m_datePattern, 
System.Globalization.DateTimeFormatInfo.InvariantInfo);
                                if (m_scheduledFilename.Equals(File + 
dateFormat)) 
                                {
                                        ErrorHandler.Error("Compare " + 
m_scheduledFilename + " : " + File + dateFormat);
                                        return;
                                }

if the date pattern specifies only the year (rolling yearly), then i think this 
"error" will be triggered incorrectly 11 times a year. it's fine not to roll, 
but reporting an error is inappropriate.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to