org.objectweb.util.monolog.wrapper.log4j
Class GenericHandler
java.lang.Object
org.objectweb.util.monolog.wrapper.log4j.GenericHandler
- All Implemented Interfaces:
- org.apache.log4j.Appender, Handler
public class GenericHandler
- extends Object
- implements org.apache.log4j.Appender, Handler
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.
- Author:
- Sebastien Chassande-Barrioz
| Fields inherited from interface org.objectweb.util.monolog.api.Handler |
APPEND_MODE_ATTRIBUTE, BUFFER_ATTRIBUTE, CONSOLE_HANDLER_TYPE, FILE_HANDLER_TYPE, FILE_NUMBER_ATTRIBUTE, GENERIC_HANDLER_TYPE, JMX_HANDLER_TYPE, LEVEL_ATTRIBUTE, LOGGER_HANDLER_TYPE, MAX_SIZE_ATTRIBUTE, OUTPUT_ATTRIBUTE, PATTERN_ATTRIBUTE, ROLLING_FILE_HANDLER_TYPE |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
- See Also:
- Constant Field Values
appender
protected org.apache.log4j.Appender appender
- The inner appender
name
protected String name
- The appender name
prop
protected HashMap prop
- The properties of the appender
filters
protected ArrayList filters
layout
protected org.apache.log4j.Layout layout
GenericHandler
public GenericHandler()
GenericHandler
public GenericHandler(String name)
GenericHandler
public GenericHandler(org.apache.log4j.Appender a)
getAppender
public org.apache.log4j.Appender getAppender()
setAppender
public void setAppender(org.apache.log4j.Appender a)
getName
public String getName()
- Specified by:
getName in interface org.apache.log4j.Appender- Specified by:
getName in interface Handler
setName
public void setName(String n)
- Specified by:
setName in interface org.apache.log4j.Appender- Specified by:
setName in interface Handler
getType
public String getType()
- Specified by:
getType in interface Handler
getAttributeNames
public String[] getAttributeNames()
- Specified by:
getAttributeNames in interface Handler
getAttribute
public Object getAttribute(String key)
- Specified by:
getAttribute in interface Handler
setAttribute
public Object setAttribute(String key,
Object value)
- Specified by:
setAttribute in interface Handler
addFilter
public void addFilter(org.apache.log4j.spi.Filter newFilter)
- Specified by:
addFilter in interface org.apache.log4j.Appender
clearFilters
public void clearFilters()
- Specified by:
clearFilters in interface org.apache.log4j.Appender
close
public void close()
- Specified by:
close in interface org.apache.log4j.Appender
doAppend
public void doAppend(org.apache.log4j.spi.LoggingEvent event)
- Specified by:
doAppend in interface org.apache.log4j.Appender
setErrorHandler
public void setErrorHandler(org.apache.log4j.spi.ErrorHandler errorHandler)
- Specified by:
setErrorHandler in interface org.apache.log4j.Appender
setLayout
public void setLayout(org.apache.log4j.Layout layout)
- Specified by:
setLayout in interface org.apache.log4j.Appender
getFilter
public org.apache.log4j.spi.Filter getFilter()
- Specified by:
getFilter in interface org.apache.log4j.Appender
getErrorHandler
public org.apache.log4j.spi.ErrorHandler getErrorHandler()
- Specified by:
getErrorHandler in interface org.apache.log4j.Appender
getLayout
public org.apache.log4j.Layout getLayout()
- Specified by:
getLayout in interface org.apache.log4j.Appender
requiresLayout
public boolean requiresLayout()
- Specified by:
requiresLayout in interface org.apache.log4j.Appender
Copyright © 2012 OW2 Consortium. All Rights Reserved.