org.apache.log4j

Interface Appender

public interface Appender

Implement this interface for your own strategies for outputting log statements.

Author: Ceki Gülcü

Method Summary
voidaddFilter(Filter newFilter)
Add a filter to the end of the filter list.
voidclearFilters()
Clear the list of filters by removing all the filters in it.
voidclose()
Release any resources allocated within the appender such as file handles, network connections, etc.
voiddoAppend(LoggingEvent event)
Log in Appender specific way.
ErrorHandlergetErrorHandler()
Returns the {@link ErrorHandler} for this appender.
FiltergetFilter()
Returns the head Filter.
LayoutgetLayout()
Returns this appenders layout.
StringgetName()
Get the name of this appender.
booleanrequiresLayout()
Configurators call this method to determine if the appender requires a layout.
voidsetErrorHandler(ErrorHandler errorHandler)
Set the {@link ErrorHandler} for this appender.
voidsetLayout(Layout layout)
Set the {@link Layout} for this appender.
voidsetName(String name)
Set the name of this appender.

Method Detail

addFilter

public void addFilter(Filter newFilter)
Add a filter to the end of the filter list.

Since: 0.9.0

clearFilters

public void clearFilters()
Clear the list of filters by removing all the filters in it.

Since: 0.9.0

close

public void close()
Release any resources allocated within the appender such as file handles, network connections, etc.

It is a programming error to append to a closed appender.

Since: 0.8.4

doAppend

public void doAppend(LoggingEvent event)
Log in Appender specific way. When appropriate, Loggers will call the doAppend method of appender implementations in order to log.

getErrorHandler

public ErrorHandler getErrorHandler()
Returns the {@link ErrorHandler} for this appender.

Since: 1.1

getFilter

public Filter getFilter()
Returns the head Filter. The Filters are organized in a linked list and so all Filters on this Appender are available through the result.

Returns: the head Filter or null, if no Filters are present

Since: 1.1

getLayout

public Layout getLayout()
Returns this appenders layout.

Since: 1.1

getName

public String getName()
Get the name of this appender. The name uniquely identifies the appender.

requiresLayout

public boolean requiresLayout()
Configurators call this method to determine if the appender requires a layout. If this method returns true, meaning that layout is required, then the configurator will configure an layout using the configuration information at its disposal. If this method returns false, meaning that a layout is not required, then layout configuration will be skipped even if there is available layout configuration information at the disposal of the configurator..

In the rather exceptional case, where the appender implementation admits a layout but can also work without it, then the appender should return true.

Since: 0.8.4

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Set the {@link ErrorHandler} for this appender.

Since: 0.9.0

setLayout

public void setLayout(Layout layout)
Set the {@link Layout} for this appender.

Since: 0.8.1

setName

public void setName(String name)
Set the name of this appender. The name is used by other components to identify this appender.

Since: 0.8.1

Copyright 2000-2005 Apache Software Foundation.