You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ca...@apache.org on 2008/08/13 00:04:52 UTC

svn commit: r685338 - in /logging/log4j/trunk: src/changes/changes.xml src/main/java/org/apache/log4j/DailyRollingFileAppender.java tests/src/java/org/apache/log4j/DRFATestCase.java

Author: carnold
Date: Tue Aug 12 15:04:51 2008
New Revision: 685338

URL: http://svn.apache.org/viewvc?rev=685338&view=rev
Log:
Bug 40888: Weekly rotation problem in Europe

Modified:
    logging/log4j/trunk/src/changes/changes.xml
    logging/log4j/trunk/src/main/java/org/apache/log4j/DailyRollingFileAppender.java
    logging/log4j/trunk/tests/src/java/org/apache/log4j/DRFATestCase.java

Modified: logging/log4j/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/changes/changes.xml?rev=685338&r1=685337&r2=685338&view=diff
==============================================================================
--- logging/log4j/trunk/src/changes/changes.xml (original)
+++ logging/log4j/trunk/src/changes/changes.xml Tue Aug 12 15:04:51 2008
@@ -53,6 +53,7 @@
        <action action="fix" issue="44899">Extra NPE error message when using missing appender class with DOMConfigurator.</action>
        <action action="fix" issue="44555">org.apache.log4j.varia.NullAppender lacks static accessor to static instance.</action>
        <action action="fix" issue="43849">Javadoc for Appender.getName implies that the return value will be unique and not null.</action>
+       <action action="fix" issue="40888">Weekly rotation problem in Europe.</action>
     </release>
   
     <release version="1.2.15" date="2007-08-24" description="SyslogAppender enhancements, NTEventLogAppender and Maven build.">

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/DailyRollingFileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/DailyRollingFileAppender.java?rev=685338&r1=685337&r2=685338&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/DailyRollingFileAppender.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/DailyRollingFileAppender.java Tue Aug 12 15:04:51 2008
@@ -270,7 +270,7 @@
   // GMT (the epoch).
 
   int computeCheckPeriod() {
-    RollingCalendar rollingCalendar = new RollingCalendar(gmtTimeZone, Locale.ENGLISH);
+    RollingCalendar rollingCalendar = new RollingCalendar(gmtTimeZone, Locale.getDefault());
     // set sate to 1970-01-01 00:00:00 GMT
     Date epoch = new Date(0);
     if(datePattern != null) {

Modified: logging/log4j/trunk/tests/src/java/org/apache/log4j/DRFATestCase.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/tests/src/java/org/apache/log4j/DRFATestCase.java?rev=685338&r1=685337&r2=685338&view=diff
==============================================================================
--- logging/log4j/trunk/tests/src/java/org/apache/log4j/DRFATestCase.java (original)
+++ logging/log4j/trunk/tests/src/java/org/apache/log4j/DRFATestCase.java Tue Aug 12 15:04:51 2008
@@ -502,5 +502,16 @@
                 "witness/drfa_blockedRollover.log"));
     }
 
+    /** Check that the computed rollover period for a pattern containing a week as the finest unit is set to be
+     * a week.  Due to a locale mismatch this was incorrect in non-English locales.  See bug 40888.
+     *
+     */
+    public void testWeeklyRollover() {
+        DailyRollingFileAppender drfa = new DailyRollingFileAppender();
+    	drfa.setDatePattern("'.'yyyy-ww");
+		int checkPeriod = drfa.computeCheckPeriod();
+		assertEquals(DailyRollingFileAppender.TOP_OF_WEEK, checkPeriod);
+    }
+
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org