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.Appender;
20 import org.apache.log4j.spi.LoggingEvent;
21 import org.apache.log4j.spi.OptionHandler;
22
23
24 /***
25 * A <code>TriggeringPolicy</code> controls the conditions under which rollover
26 * occurs. Such conditions include time of day, file size, an
27 * external event, the log request or a combination thereof.
28 *
29 * @author Ceki Gülcü
30 * @author Curt Arnold
31 *
32 */
33 public interface TriggeringPolicy extends OptionHandler {
34 /***
35 * Determines if a rollover may be appropriate at this time. If
36 * true is returned, RolloverPolicy.rollover will be called but it
37 * can determine that a rollover is not warranted.
38 *
39 * @param appender A reference to the appender.
40 * @param event A reference to the currently event.
41 * @param filename The filename for the currently active log file.
42 * @param fileLength Length of the file in bytes.
43 * @return true if a rollover should occur.
44 */
45 public boolean isTriggeringEvent(
46 final Appender appender, final LoggingEvent event, final String filename,
47 final long fileLength);
48 }