1 /** 2 * Logback: the reliable, generic, fast and flexible logging framework. 3 * Copyright (C) 1999-2022, QOS.ch. All rights reserved. 4 * 5 * This program and the accompanying materials are dual-licensed under 6 * either the terms of the Eclipse Public License v1.0 as published by 7 * the Eclipse Foundation 8 * 9 * or (per the licensee's choosing) 10 * 11 * under the terms of the GNU Lesser General Public License version 2.1 12 * as published by the Free Software Foundation. 13 */ 14 package ch.qos.logback.core.rolling; 15 16 import ch.qos.logback.core.rolling.helper.ArchiveRemover; 17 import ch.qos.logback.core.spi.ContextAware; 18 19 /** 20 * This interface lists the set of methods that need to be implemented by 21 * triggering policies which are nested within a {@link TimeBasedRollingPolicy}. 22 * 23 * <p>This interface should be considered as an extension of {@link TimeBasedRollingPolicy} with file naming 24 * support methods. 25 * </p> 26 * 27 * @See also {@link TimeBasedFileNamingAndTriggeringPolicyBase} 28 * 29 * @author Ceki Gülcü 30 * 31 * @param <E> 32 */ 33 public interface TimeBasedFileNamingAndTriggeringPolicy<E> extends TriggeringPolicy<E>, ContextAware { 34 35 /** 36 * Set the host/parent {@link TimeBasedRollingPolicy}. 37 * 38 * @param tbrp parent TimeBasedRollingPolicy 39 */ 40 void setTimeBasedRollingPolicy(TimeBasedRollingPolicy<E> tbrp); 41 42 /** 43 * Return the file name for the elapsed periods file name. 44 * 45 * @return 46 */ 47 String getElapsedPeriodsFileName(); 48 49 /** 50 * Return the current periods file name without the compression suffix. This 51 * value is equivalent to the active file name. 52 * 53 * @return current period's file name (without compression suffix) 54 */ 55 String getCurrentPeriodsFileNameWithoutCompressionSuffix(); 56 57 /** 58 * Return the archive remover appropriate for this instance. 59 */ 60 ArchiveRemover getArchiveRemover(); 61 62 /** 63 * Return the current time which is usually the value returned by 64 * System.currentMillis(). However, for <b>testing</b> purposed this value may 65 * be different than the real time. 66 * 67 * @return current time value 68 */ 69 long getCurrentTime(); 70 71 /** 72 * Set the current time. Only unit tests should invoke this method. 73 * 74 * @param now 75 */ 76 void setCurrentTime(long now); 77 78 /** 79 * Set some date in the current period. Only unit tests should invoke this 80 * method. 81 * 82 * WARNING: method removed. A unit test should not set the date in current 83 * period. It is the job of the FNATP to compute that. 84 * 85 * @param date 86 */ 87 // void setDateInCurrentPeriod(Date date); 88 }