001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.core.rolling; 015 016import ch.qos.logback.core.FileAppender; 017import ch.qos.logback.core.rolling.helper.CompressionMode; 018import ch.qos.logback.core.spi.LifeCycle; 019 020/** 021 * A <code>RollingPolicy</code> is responsible for performing the rolling over 022 * of the active log file. The <code>RollingPolicy</code> is also responsible 023 * for providing the <em>active log file</em>, that is the live file where 024 * logging output will be directed. 025 * 026 * @author Ceki Gülcü 027 */ 028public interface RollingPolicy extends LifeCycle { 029 030 /** 031 * Rolls over log files according to implementation policy. 032 * 033 * <p> 034 * This method is invoked by {@link RollingFileAppender}, usually at the behest 035 * of its {@link TriggeringPolicy}. 036 * 037 * @throws RolloverFailure Thrown if the rollover operation fails for any 038 * reason. 039 */ 040 void rollover() throws RolloverFailure; 041 042 /** 043 * Get the name of the active log file. 044 * 045 * <p> 046 * With implementations such as {@link TimeBasedRollingPolicy}, this method 047 * returns a new file name, where the actual output will be sent. 048 * 049 * <p> 050 * On other implementations, this method might return the FileAppender's file 051 * property. 052 */ 053 String getActiveFileName(); 054 055 /** 056 * The compression mode for this policy. 057 * 058 * @return 059 */ 060 CompressionMode getCompressionMode(); 061 062 /** 063 * This method allows RollingPolicy implementations to be aware of their 064 * containing appender. 065 * 066 * @param appender 067 */ 068 069 void setParent(FileAppender<?> appender); 070}