|
Log4j 1.0.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.log4j.AppenderSkeleton | +--org.apache.log4j.AsyncAppender
The AsyncAppender lets users log events asynchronously. It uses a bounded buffer to store logging events.
The AsyncAppender will collect the events sent to it and then dispatch them to all the appenders that are attached to it. You can attach multiple appenders to an AsyncAppender.
The AsyncAppender uses a separate thread to serve the events in its bounded buffer.
Refer to the results in Logging
for the impact of using this appender.
Important note: The AsyncAppender
can only
be script configured using the DOMConfigurator
.
Field Summary | |
static String |
LOCATION_INFO_OPTION
A string constant used in naming the option for setting the the location information flag. |
Fields inherited from class org.apache.log4j.AppenderSkeleton |
closed, errorHandler, headFilter, layout, name, tailFilter, threshold, THRESHOLD_OPTION |
Constructor Summary | |
AsyncAppender()
|
Method Summary | |
void |
addAppender(Appender newAppender)
Add an appender. |
void |
append(LoggingEvent event)
Subclasses of AppenderSkeleton should imlement this
method to perform actual logging. |
void |
close()
Close this AsyncAppender by interrupting the
dispatcher thread which will process all pending events before
exiting. |
Enumeration |
getAllAppenders()
Get all previously added appenders as an Enumeration. |
Appender |
getAppender(String name)
Get an appender by name. |
String[] |
getOptionStrings()
Retuns the option names for this component in addition in addition to the options of its super class AppenderSkeleton . |
void |
removeAllAppenders()
Remove all previously added appenders. |
void |
removeAppender(Appender appender)
Remove the appender passed as parameter form the list of appenders. |
void |
removeAppender(String name)
Remove the appender with the name passed as parameter form the list of appenders. |
boolean |
requiresLayout()
The AsyncAppender does not require a layout. |
void |
setOption(String option,
String value)
Set AsyncAppender specific options. |
Methods inherited from class org.apache.log4j.AppenderSkeleton |
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFirstFilter, getName, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String LOCATION_INFO_OPTION
Note that all option keys are case sensitive.
Constructor Detail |
public AsyncAppender()
Method Detail |
public void addAppender(Appender newAppender)
AppenderAttachable
addAppender
in interface AppenderAttachable
public void append(LoggingEvent event)
AppenderSkeleton
AppenderSkeleton
should imlement this
method to perform actual logging. See also AppenderSkeleton.doAppend
method.append
in class AppenderSkeleton
public void close()
AsyncAppender
by interrupting the
dispatcher thread which will process all pending events before
exiting.public Enumeration getAllAppenders()
AppenderAttachable
getAllAppenders
in interface AppenderAttachable
public Appender getAppender(String name)
AppenderAttachable
getAppender
in interface AppenderAttachable
public String[] getOptionStrings()
AppenderSkeleton
.getOptionStrings
in class AppenderSkeleton
public boolean requiresLayout()
AsyncAppender
does not require a layout. Hence,
this method always returns false
.public void removeAllAppenders()
AppenderAttachable
removeAllAppenders
in interface AppenderAttachable
public void removeAppender(Appender appender)
AppenderAttachable
removeAppender
in interface AppenderAttachable
public void removeAppender(String name)
AppenderAttachable
removeAppender
in interface AppenderAttachable
public void setOption(String option, String value)
On top of the options of the super class AppenderSkeleton
, the only recognized options is
LocationInfo.
The LocationInfo option takes a boolean value. By default, it is set to false which means there will be no effort to extract the location information related to the event. As a result, the event that will be ultimately logged will likely to contain the wrong location information (if present in the log format).
Location information extraction is comparatively very slow and should be avoided unless performance is not a concern.
setOption
in class AppenderSkeleton
|
Log4j 1.0.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |