1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.log4j.rule;
21
22 import org.apache.log4j.spi.LoggingEvent;
23
24 import java.beans.PropertyChangeListener;
25 import java.util.Map;
26
27
28 /***
29 * A Rule evaluates to true of false given a LoggingEvent object, and can notify
30 * listeners when the underlying implementation of this Rule has it's
31 * criteria changed by using the standard PropertyChangeListener infrastructure.
32 *
33 * @author Paul Smith (psmith@apache.org)
34 * @author Scott Deboy (sdeboy@apache.org)
35 */
36 public interface Rule {
37 /***
38 * Returns true if this implementation of the rule accepts the LoggingEvent,
39 * or false if not.
40 *
41 * <p>What True/False means can be client-specific.
42 *
43 * @param e LoggingEvent this instance will evaluate
44 * @param matches a Map of event field keys to Sets of matching strings (may be null) which will be
45 * updated during execution of this method to include field and string matches based on the rule
46 * evaluation results
47 * @return true if this Rule instance accepts the event, otherwise false.
48 */
49 boolean evaluate(LoggingEvent e, Map matches);
50
51 /***
52 * Adds a PropertyChangeListener to this instance, which is notified when
53 * underlying Rule information has changed.
54 * (there are no specific property name events).
55 * @param listener listener
56 */
57 void addPropertyChangeListener(PropertyChangeListener listener);
58
59 /***
60 * Removes a known PropertyChangeListener from this Rule.
61 * @param listener listener
62 */
63 void removePropertyChangeListener(PropertyChangeListener listener);
64 }