[logback-dev] svn commit: r2366 - logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling

noreply.ceki at qos.ch noreply.ceki at qos.ch
Wed Jul 22 23:07:04 CEST 2009


Author: ceki
Date: Wed Jul 22 23:07:03 2009
New Revision: 2366

Modified:
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java

Log:
- minor internal refactoring

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java	Wed Jul 22 23:07:03 2009
@@ -47,7 +47,6 @@
   String elapsedPeriodsFileName;
   FileNamePattern activeFileNamePattern;
   RenameUtil util = new RenameUtil();
-  String latestActiveFileName;
   Future<?> future;
 
   int maxHistory = NO_DELETE_HISTORY;
@@ -221,15 +220,20 @@
    * 
    */
   public String getActiveFileName() {
-    if (getParentsRawFileProperty() == null) {
-      String newName = activeFileNamePattern.convertDate(lastCheck);
-      latestActiveFileName = newName;
-      return newName;
+    String parentsRawFileProperty = getParentsRawFileProperty();
+    
+    if (parentsRawFileProperty != null) {
+      return parentsRawFileProperty;
     } else {
-      return getParentsRawFileProperty();
-    }
+      return getLatestPeriodsFileName();
+    } 
   }
 
+  // get the active file name for the current (latest) period
+  private String getLatestPeriodsFileName() {
+    return activeFileNamePattern.convertDate(lastCheck);
+  }
+  
   public boolean isTriggeringEvent(File activeFile, final E event) {
     long time = getCurrentTime();
 


More information about the logback-dev mailing list