1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.log4j;
19
20 import org.apache.log4j.spi.Filter;
21 import org.apache.log4j.spi.ErrorHandler;
22 import org.apache.log4j.spi.LoggingEvent;
23
24 /***
25 Implement this interface for your own strategies for outputting log
26 statements.
27
28 @author Ceki Gülcü
29 */
30 public interface Appender {
31
32 /***
33 Add a filter to the end of the filter list.
34
35 @since 0.9.0
36 */
37 void addFilter(Filter newFilter);
38
39 /***
40 Returns the head Filter. The Filters are organized in a linked list
41 and so all Filters on this Appender are available through the result.
42
43 @return the head Filter or null, if no Filters are present
44 @since 1.1
45 */
46 public
47 Filter getFilter();
48
49 /***
50 Clear the list of filters by removing all the filters in it.
51
52 @since 0.9.0
53 */
54 public
55 void clearFilters();
56
57 /***
58 Release any resources allocated within the appender such as file
59 handles, network connections, etc.
60
61 <p>It is a programming error to append to a closed appender.
62
63 @since 0.8.4
64 */
65 public
66 void close();
67
68 /***
69 Log in <code>Appender</code> specific way. When appropriate,
70 Loggers will call the <code>doAppend</code> method of appender
71 implementations in order to log. */
72 public
73 void doAppend(LoggingEvent event);
74
75
76 /***
77 Get the name of this appender. The name uniquely identifies the
78 appender. */
79 public
80 String getName();
81
82
83 /***
84 Set the {@link ErrorHandler} for this appender.
85
86 @since 0.9.0
87 */
88 public
89 void setErrorHandler(ErrorHandler errorHandler);
90
91 /***
92 Returns the {@link ErrorHandler} for this appender.
93
94 @since 1.1
95 */
96 public
97 ErrorHandler getErrorHandler();
98
99 /***
100 Set the {@link Layout} for this appender.
101
102 @since 0.8.1
103 */
104 public
105 void setLayout(Layout layout);
106
107 /***
108 Returns this appenders layout.
109
110 @since 1.1
111 */
112 public
113 Layout getLayout();
114
115
116 /***
117 Set the name of this appender. The name is used by other
118 components to identify this appender.
119
120 @since 0.8.1
121 */
122 public
123 void setName(String name);
124
125 /***
126 Configurators call this method to determine if the appender
127 requires a layout. If this method returns <code>true</code>,
128 meaning that layout is required, then the configurator will
129 configure an layout using the configuration information at its
130 disposal. If this method returns <code>false</code>, meaning that
131 a layout is not required, then layout configuration will be
132 skipped even if there is available layout configuration
133 information at the disposal of the configurator..
134
135 <p>In the rather exceptional case, where the appender
136 implementation admits a layout but can also work without it, then
137 the appender should return <code>true</code>.
138
139 @since 0.8.4 */
140 public
141 boolean requiresLayout();
142 }