public class AsyncAppender
extends org.apache.log4j.AppenderSkeleton
implements org.apache.log4j.spi.AppenderAttachable
AsyncAppender can only be script
configured using the DOMConfigurator.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
The default buffer size is set to 128 events.
|
| Constructor and Description |
|---|
AsyncAppender()
Create new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAppender(org.apache.log4j.Appender newAppender)
Add appender.
|
void |
append(org.apache.log4j.spi.LoggingEvent event) |
void |
close()
Close this
AsyncAppender by interrupting the dispatcher thread
which will process all pending events before exiting. |
void |
doAppend(org.apache.log4j.spi.LoggingEvent event) |
Enumeration |
getAllAppenders()
Get iterator over attached appenders.
|
org.apache.log4j.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(org.apache.log4j.Appender appender)
Determines if specified appender is attached.
|
void |
removeAllAppenders()
Removes and closes all attached appenders.
|
void |
removeAppender(org.apache.log4j.Appender appender)
Removes an appender.
|
void |
removeAppender(String name)
Remove appender by name.
|
boolean |
requiresLayout() |
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.
|
public static final int DEFAULT_BUFFER_SIZE
public void doAppend(org.apache.log4j.spi.LoggingEvent event)
doAppend in interface org.apache.log4j.AppenderdoAppend in class org.apache.log4j.AppenderSkeletonpublic void addAppender(org.apache.log4j.Appender newAppender)
addAppender in interface org.apache.log4j.spi.AppenderAttachablenewAppender - appender to add, may not be null.public void append(org.apache.log4j.spi.LoggingEvent event)
append in class org.apache.log4j.AppenderSkeletonpublic void close()
AsyncAppender by interrupting the dispatcher thread
which will process all pending events before exiting.close in interface org.apache.log4j.Appenderpublic Enumeration getAllAppenders()
getAllAppenders in interface org.apache.log4j.spi.AppenderAttachablepublic org.apache.log4j.Appender getAppender(String name)
getAppender in interface org.apache.log4j.spi.AppenderAttachablename - name, may not be null.public boolean getLocationInfo()
public boolean isAttached(org.apache.log4j.Appender appender)
isAttached in interface org.apache.log4j.spi.AppenderAttachableappender - appender.public boolean requiresLayout()
requiresLayout in interface org.apache.log4j.Appenderpublic void removeAllAppenders()
removeAllAppenders in interface org.apache.log4j.spi.AppenderAttachablepublic void removeAppender(org.apache.log4j.Appender appender)
removeAppender in interface org.apache.log4j.spi.AppenderAttachableappender - appender to remove.public void removeAppender(String name)
removeAppender in interface org.apache.log4j.spi.AppenderAttachablename - 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()
Copyright © 2006–2022 OPS4J - Open Participation Software for Java. All rights reserved.