1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.log4j.rolling;
18
19 import org.apache.log4j.spi.OptionHandler;
20
21
22 /***
23 * A <code>RollingPolicy</code> specifies the actions taken
24 * on a logging file rollover.
25 *
26 * @author Ceki Gülcü
27 * @author Curt Arnold
28 * */
29 public interface RollingPolicy extends OptionHandler {
30 /***
31 * Initialize the policy and return any initial actions for rolling file appender..
32 *
33 * @param file current value of RollingFileAppender.getFile().
34 * @param append current value of RollingFileAppender.getAppend().
35 * @return Description of the initialization, may be null to indicate
36 * no initialization needed.
37 * @throws SecurityException if denied access to log files.
38 */
39 public RolloverDescription initialize(
40 final String file, final boolean append) throws SecurityException;
41
42 /***
43 * Prepare for a rollover. This method is called prior to
44 * closing the active log file, performs any necessary
45 * preliminary actions and describes actions needed
46 * after close of current log file.
47 *
48 * @param activeFile file name for current active log file.
49 * @return Description of pending rollover, may be null to indicate no rollover
50 * at this time.
51 * @throws SecurityException if denied access to log files.
52 */
53 public RolloverDescription rollover(final String activeFile) throws SecurityException;
54 }