Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Logback: the reliable, generic, fast and flexible logging framework. Copyright (C) 1999-2011, QOS.ch. All rights reserved. This program and the accompanying materials are dual-licensed under either the terms of the Eclipse Public License v1.0 as published by the Eclipse Foundation or (per the licensee's choosing) under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.
 
 package ch.qos.logback.core.rolling;
 
 import java.io.File;
 import java.util.Date;
 
 
 abstract public class TimeBasedFileNamingAndTriggeringPolicyBase<E> extends
         ContextAwareBase implements TimeBasedFileNamingAndTriggeringPolicy<E> {
 
   protected TimeBasedRollingPolicy<E> tbrp;
 
   protected ArchiveRemover archiveRemover = null;
   protected String elapsedPeriodsFileName;
   protected RollingCalendar rc;
 
   protected long artificialCurrentTime = -1;
   protected Date dateInCurrentPeriod = null;
 
   protected long nextCheck;
   protected boolean started = false;
 
   public boolean isStarted() {
     return ;
   }
 
   public void start() {
     if (dtc == null) {
       throw new IllegalStateException("FileNamePattern ["
               + ..getPattern()
               + "] does not contain a valid DateToken");
     }
 
      = new RollingCalendar();
     .init(dtc.getDatePattern());
     addInfo("The date pattern is '" + dtc.getDatePattern()
             + "' from file name pattern '" + ..getPattern()
             + "'.");
     .printPeriodicity(this);
 
     if (.getParentsRawFileProperty() != null) {
       File currentFile = new File(.getParentsRawFileProperty());
       if (currentFile.exists() && currentFile.canRead()) {
         setDateInCurrentPeriod(new Date(currentFile.lastModified()));
       }
     }
 
     addInfo("Setting initial period to " + );
     computeNextCheck();
   }
 
   public void stop() {
      = false;
   }
 
   protected void computeNextCheck() {
   }
 
   protected void setDateInCurrentPeriod(long now) {
   }
 
   // allow Test classes to act on the dateInCurrentPeriod field to simulate old
   // log files needing rollover
   public void setDateInCurrentPeriod(Date _dateInCurrentPeriod) {
     this. = _dateInCurrentPeriod;
   }
 
     return ;
   }
 
   }
 
   public void setCurrentTime(long timeInMillis) {
      = timeInMillis;
   }
 
  public long getCurrentTime() {
    // if time is forced return the time set by user
    if ( >= 0) {
      return ;
    } else {
      return System.currentTimeMillis();
    }
  }
    this. = _tbrp;
  }
    return ;
  }
New to GrepCode? Check out our FAQ X