|
Log4j 1.2.14 | |||||||||
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.
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 buffer. Important note: TheAsyncAppender
can only be script
configured using the DOMConfigurator
.
Field Summary | |
static int |
DEFAULT_BUFFER_SIZE
The default buffer size is set to 128 events. |
Fields inherited from class org.apache.log4j.AppenderSkeleton |
closed, errorHandler, headFilter, layout, name, tailFilter, threshold |
Constructor Summary | |
AsyncAppender()
Create new instance. |
Method Summary | |
void |
addAppender(Appender newAppender)
Add appender. |
void |
append(LoggingEvent event)
{@inheritDoc} |
void |
close()
Close this AsyncAppender by interrupting the dispatcher
thread which will process all pending events before exiting. |
Enumeration |
getAllAppenders()
Get iterator over attached appenders. |
Appender |
getAppender(String name)
Get appender by name. |
boolean |
getBlocking()
Gets whether appender should block calling thread when buffer is full. |
int |
getBufferSize()
Gets the current buffer size. |
boolean |
getLocationInfo()
Gets whether the location of the logging request call should be captured. |
boolean |
isAttached(Appender appender)
Determines if specified appender is attached. |
void |
removeAllAppenders()
Removes and closes all attached appenders. |
void |
removeAppender(Appender appender)
Removes an appender. |
void |
removeAppender(String name)
Remove appender by name. |
boolean |
requiresLayout()
{@inheritDoc} |
void |
setBlocking(boolean value)
Sets whether appender should wait if there is no space available in the event buffer or immediately return. |
void |
setBufferSize(int size)
Sets the number of messages allowed in the event buffer before the calling thread is blocked (if blocking is true) or until messages are summarized and discarded. |
void |
setLocationInfo(boolean flag)
The LocationInfo option takes a boolean value. |
Methods inherited from class org.apache.log4j.AppenderSkeleton |
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, 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 int DEFAULT_BUFFER_SIZE
Constructor Detail |
public AsyncAppender()
Method Detail |
public void addAppender(Appender newAppender)
addAppender
in interface AppenderAttachable
newAppender
- appender to add, may not be null.public void append(LoggingEvent event)
append
in class AppenderSkeleton
public void close()
AsyncAppender
by interrupting the dispatcher
thread which will process all pending events before exiting.public Enumeration getAllAppenders()
getAllAppenders
in interface AppenderAttachable
public Appender getAppender(String name)
getAppender
in interface AppenderAttachable
name
- name, may not be null.public boolean getLocationInfo()
public boolean isAttached(Appender appender)
isAttached
in interface AppenderAttachable
appender
- appender.public boolean requiresLayout()
public void removeAllAppenders()
removeAllAppenders
in interface AppenderAttachable
public void removeAppender(Appender appender)
removeAppender
in interface AppenderAttachable
appender
- appender to remove.public void removeAppender(String name)
removeAppender
in interface AppenderAttachable
name
- name.public void setLocationInfo(boolean flag)
flag
- true if location information should be extracted.public void setBufferSize(int size)
size
- buffer size, must be positive.public int getBufferSize()
public void setBlocking(boolean value)
value
- true if appender should wait until available space in buffer.public boolean getBlocking()
|
Log4j 1.2.14 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |