View Javadoc

1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * 
4    * Copyright (C) 1999-2006, QOS.ch
5    * 
6    * This library is free software, you can redistribute it and/or modify it under
7    * the terms of the GNU Lesser General Public License as published by the Free
8    * Software Foundation.
9    */
10  package ch.qos.logback.core.rolling;
11  
12  import ch.qos.logback.core.FileAppender;
13  import ch.qos.logback.core.rolling.helper.CompressionMode;
14  import ch.qos.logback.core.spi.LifeCycle;
15  
16  /**
17   * A <code>RollingPolicy</code> is responsible for performing the rolling over
18   * of the active log file. The <code>RollingPolicy</code> is also responsible
19   * for providing the <em>active log file</em>, that is the live file where
20   * logging output will be directed.
21   * 
22   * @author Ceki G&uuml;lc&uuml;
23   */
24  public interface RollingPolicy extends LifeCycle {
25  
26    /**
27     * Rolls over log files according to implementation policy.
28     * 
29     * <p>This method is invoked by {@link RollingFileAppender}, usually at the
30     * behest of its {@link TriggeringPolicy}.
31     * 
32     * @throws RolloverFailure
33     *                 Thrown if the rollover operation fails for any reason.
34     */
35    public void rollover() throws RolloverFailure;
36  
37    /**
38     * Get the name of the active log file.
39     * 
40     * <p>With implementations such as {@link TimeBasedRollingPolicy}, this
41     * method returns a new file name, where the actual output will be sent.
42     * 
43     * <p>On other implementations, this method might return the FileAppender's
44     * file property.
45     */
46    public String getActiveFileName();
47  
48    /**
49     * The compression mode for this policy.
50     * 
51     * @return
52     */
53    public CompressionMode getCompressionMode();
54    
55    /**
56     * This method allows RollingPolicy implementations to be aware of their
57     * containing appender.
58     * 
59     * @param appender
60     */
61  
62    public void setParent(FileAppender appender);
63  }