Package org.apache.log4j
Interface Appender
-
- All Known Implementing Classes:
AppenderSkeleton,AppenderWrapper,ConsoleAppender,FileAppender,NullAppender,RollingFileAppender,VectorAppender,WriterAppender
public interface AppenderImplement this interface for your own strategies for outputting log statements.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 inAppenderspecific way.ErrorHandlergetErrorHandler()Returns theErrorHandlerfor this appender.FiltergetFilter()Returns the head Filter.LayoutgetLayout()Returns this appenders layout.java.lang.StringgetName()Get the name of this appender.booleanrequiresLayout()Configurators call this method to determine if the appender requires a layout.voidsetErrorHandler(ErrorHandler errorHandler)Set theErrorHandlerfor this appender.voidsetLayout(Layout layout)Set theLayoutfor this appender.voidsetName(java.lang.String name)Set the name of this appender.
-
-
-
Method Detail
-
addFilter
void addFilter(Filter newFilter)
Add a filter to the end of the filter list.- Parameters:
newFilter- The filter to add.- Since:
- 0.9.0
-
getFilter
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
-
clearFilters
void clearFilters()
Clear the list of filters by removing all the filters in it.- Since:
- 0.9.0
-
close
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
void doAppend(LoggingEvent event)
Log inAppenderspecific way. When appropriate, Loggers will call thedoAppendmethod of appender implementations in order to log.- Parameters:
event- The LoggingEvent.
-
getName
java.lang.String getName()
Get the name of this appender.- Returns:
- name, may be null.
-
setErrorHandler
void setErrorHandler(ErrorHandler errorHandler)
Set theErrorHandlerfor this appender.- Parameters:
errorHandler- The error handler.- Since:
- 0.9.0
-
getErrorHandler
ErrorHandler getErrorHandler()
Returns theErrorHandlerfor this appender.- Returns:
- The error handler.
- Since:
- 1.1
-
setLayout
void setLayout(Layout layout)
Set theLayoutfor this appender.- Parameters:
layout- The Layout.- Since:
- 0.8.1
-
getLayout
Layout getLayout()
Returns this appenders layout.- Returns:
- the Layout.
- Since:
- 1.1
-
setName
void setName(java.lang.String name)
Set the name of this appender. The name is used by other components to identify this appender.- Parameters:
name- The appender name.- Since:
- 0.8.1
-
requiresLayout
boolean requiresLayout()
Configurators call this method to determine if the appender requires a layout. If this method returnstrue, meaning that layout is required, then the configurator will configure an layout using the configuration information at its disposal. If this method returnsfalse, 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.- Returns:
- true if a Layout is required.
- Since:
- 0.8.4
-
-