1 /** 2 * Logback: the reliable, generic, fast and flexible logging framework. 3 * Copyright (C) 1999-2015, 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.FileAppender; 17 import ch.qos.logback.core.rolling.helper.CompressionMode; 18 import ch.qos.logback.core.spi.LifeCycle; 19 20 /** 21 * A <code>RollingPolicy</code> is responsible for performing the rolling over 22 * of the active log file. The <code>RollingPolicy</code> is also responsible 23 * for providing the <em>active log file</em>, that is the live file where 24 * logging output will be directed. 25 * 26 * @author Ceki Gülcü 27 */ 28 public interface RollingPolicy extends LifeCycle { 29 30 /** 31 * Rolls over log files according to implementation policy. 32 * 33 * <p> 34 * This method is invoked by {@link RollingFileAppender}, usually at the behest 35 * of its {@link TriggeringPolicy}. 36 * 37 * @throws RolloverFailure Thrown if the rollover operation fails for any 38 * reason. 39 */ 40 void rollover() throws RolloverFailure; 41 42 /** 43 * Get the name of the active log file. 44 * 45 * <p> 46 * With implementations such as {@link TimeBasedRollingPolicy}, this method 47 * returns a new file name, where the actual output will be sent. 48 * 49 * <p> 50 * On other implementations, this method might return the FileAppender's file 51 * property. 52 */ 53 String getActiveFileName(); 54 55 /** 56 * The compression mode for this policy. 57 * 58 * @return 59 */ 60 CompressionMode getCompressionMode(); 61 62 /** 63 * This method allows RollingPolicy implementations to be aware of their 64 * containing appender. 65 * 66 * @param appender 67 */ 68 69 void setParent(FileAppender<?> appender); 70 }