org.objectweb.util.monolog.wrapper.log4j
Class GenericHandler
java.lang.Object
org.objectweb.util.monolog.wrapper.log4j.GenericHandler
- Appender, Handler
public class GenericHandler
extends java.lang.Object
This class is a generic implementation of the Handler interface. This class
delegates all calls on a log4j Appender. It is also an Appender interceptor.
This class can therefore be referenced into the log4j struture as an
Appender.
There are three ways to specify the inner Appender:
- by the construstor with the appender instance
- by the setAppender method with the appender instance
- by the setAttribute method with the appender class name. This method
tries to instanciate the class, and initializes the new Appender with all
attribute which has been specified before. Even the filters and the layout
are memorized.
- Sebastien Chassande-Barrioz
static String | APPENDER_CLASS_NAME_ATTR - This constant can be used to specify the class name of the inner appender
|
protected Appender | appender - The inner appender
|
protected ArrayList | filters
|
protected Layout | layout
|
protected String | name - The appender name
|
protected HashMap | prop - The properties of the appender
|
APPEND_MODE_ATTRIBUTE , BUFFER_ATTRIBUTE , CONSOLE_HANDLER_TYPE , FILE_HANDLER_TYPE , FILE_NUMBER_ATTRIBUTE , GENERIC_HANDLER_TYPE , LEVEL_ATTRIBUTE , LOGGER_HANDLER_TYPE , MAX_SIZE_ATTRIBUTE , OUTPUT_ATTRIBUTE , PATTERN_ATTRIBUTE , ROLLING_FILE_HANDLER_TYPE |
APPENDER_CLASS_NAME_ATTR
public static final String APPENDER_CLASS_NAME_ATTR
This constant can be used to specify the class name of the inner appender
appender
protected Appender appender
The inner appender
filters
protected ArrayList filters
layout
protected Layout layout
name
protected String name
The appender name
prop
protected HashMap prop
The properties of the appender
GenericHandler
public GenericHandler()
GenericHandler
public GenericHandler(Appender a)
GenericHandler
public GenericHandler(String name)
addFilter
public void addFilter(Filter newFilter)
clearFilters
public void clearFilters()
doAppend
public void doAppend(LoggingEvent event)
getAppender
public Appender getAppender()
getErrorHandler
public ErrorHandler getErrorHandler()
getFilter
public Filter getFilter()
getLayout
public Layout getLayout()
requiresLayout
public boolean requiresLayout()
setAppender
public void setAppender(Appender a)
setAttribute
public Object setAttribute(String key,
Object value)
- setAttribute in interface Handler
setErrorHandler
public void setErrorHandler(ErrorHandler errorHandler)
setLayout
public void setLayout(Layout layout)