Dave, This is the right place to submit patches. I will try reproduce this issue and test your patch. Out of interest which time zone is it failing for you?
Cheers, Nicko > -----Original Message----- > From: Dave Hutz [mailto:[EMAIL PROTECTED] > Sent: 23 February 2004 01:08 > To: 'Log4NET Dev' > Subject: Contributing/Bug#702507 - RollingFileAppender > incorrectly chooses half day roll point > > How do you submit a bug fix for this project? > > My fix for the referenced bug is below... > > Thanks, > Dave > > > /// <summary> > /// Calculates the RollPoint for the m_datePattern supplied. > /// </summary> > /// <returns>The RollPoint that is most accurate for the date > pattern supplied</returns> /// <remarks> /// Essentially the > date pattern is examined to determine what the /// most > suitable roll point is. The roll point chosen is the roll > point /// with the smallest period that can be detected using > the date pattern /// supplied. i.e. if the date pattern only > outputs the year, month, day /// and hour then the smallest > roll point that can be detected would be /// and hourly roll > point as minutes could not be detected. > /// </remarks> > private RollPoint ComputeCheckPeriod() > { > if (m_datePattern != null) > { > // set date to 1970-01-01 00:00:00Z this is > UniversalSortableDateTimePattern > // (based on ISO 8601) using universal time. > This date is used for reference > // purposes to calculate the resolution of the > date pattern. > // Bug#702507 - this fails if you are in a > timezone that is earlier than GMT > // Need to check both GMT and localtime. > DateTime epochA = DateTime.Parse("1970-01-01 > 00:00:00Z", System.Globalization.DateTimeFormatInfo.InvariantInfo); > DateTime epochB = DateTime.Parse("1970-01-01 > 00:00:00", System.Globalization.DateTimeFormatInfo.InvariantInfo); > > // Get string representation of base line date > string r0A = epochA.ToString(m_datePattern, > System.Globalization.DateTimeFormatInfo.InvariantInfo); > string r0B = epochB.ToString(m_datePattern, > System.Globalization.DateTimeFormatInfo.InvariantInfo); > > // Check each type of rolling mode starting > with the smallest increment. > for(int i = (int)RollPoint.TopOfMinute; i <= > (int)RollPoint.TopOfMonth; i++) > { > // Get string representation of next pattern > string r1A = NextCheckDate(epochA, > (RollPoint)i).ToString(m_datePattern, > System.Globalization.DateTimeFormatInfo.InvariantInfo); > string r1B = NextCheckDate(epochB, > (RollPoint)i).ToString(m_datePattern, > System.Globalization.DateTimeFormatInfo.InvariantInfo); > > LogLog.Debug("RollingFileAppender: Type > = ["+i+"], r0A = ["+r0A+"], r1A = ["+r1A+"]"); > LogLog.Debug("RollingFileAppender: Type > = ["+i+"], r0B = ["+r0B+"], r1B = ["+r1B+"]"); > > // Check if both the string > representations are different > if (r0A != null && r1A != null && > !r0A.Equals(r1A) && > r0B != null && r1B != null && > !r0B.Equals(r1B)) > { > // Found highest precision roll point > return (RollPoint)i; > } > } > } > return RollPoint.TopOfTrouble; // Deliberately head for > trouble... > } >
