2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package org.apache.log4j;
20 import org.apache.log4j.spi.Filter;
21 import org.apache.log4j.spi.ErrorHandler;
22 import org.apache.log4j.spi.LoggingEvent;
25 Implement this interface for your own strategies for outputting log
28 @author Ceki Gülcü
30 public interface Appender {
33 Add a filter to the end of the filter list.
37 void addFilter(Filter newFilter);
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.
43 @return the head Filter or null, if no Filters are present
50 Clear the list of filters by removing all the filters in it.
58 Release any resources allocated within the appender such as file
59 handles, network connections, etc.
61 <p>It is a programming error to append to a closed appender.
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. */
73 void doAppend(LoggingEvent event);
77 Get the name of this appender.
78 @return name, may be null.*/
84 Set the {@link ErrorHandler} for this appender.
89 void setErrorHandler(ErrorHandler errorHandler);
92 Returns the {@link ErrorHandler} for this appender.
97 ErrorHandler getErrorHandler();
100 Set the {@link Layout} for this appender.
105 void setLayout(Layout layout);
108 Returns this appenders layout.
117 Set the name of this appender. The name is used by other
118 components to identify this appender.
123 void setName(String name);
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..
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>.
141 boolean requiresLayout();