public class AsyncAppender extends AppenderSkeleton implements AppenderAttachable
AsyncAppender can only be script
configured using the DOMConfigurator.
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
The default buffer size is set to 128 events.
|
closed, errorHandler, headFilter, layout, name, tailFilter, threshold| 构造器和说明 |
|---|
AsyncAppender()
Create new instance.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addAppender(Appender newAppender)
Add appender.
|
void |
append(LoggingEvent event)
Subclasses of
AppenderSkeleton should implement this
method to perform actual logging. |
void |
close()
Close this
AsyncAppender by interrupting the dispatcher
thread which will process all pending events before exiting. |
java.util.Enumeration |
getAllAppenders()
Get iterator over attached appenders.
|
Appender |
getAppender(java.lang.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(java.lang.String name)
Remove appender by name.
|
boolean |
requiresLayout()
Configurators call this method to determine if the appender
requires a layout.
|
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.
|
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThresholdpublic static final int DEFAULT_BUFFER_SIZE
public void addAppender(Appender newAppender)
addAppender 在接口中 AppenderAttachablenewAppender - appender to add, may not be null.public void append(LoggingEvent event)
AppenderSkeleton should implement this
method to perform actual logging. See also AppenderSkeleton.doAppend method.append 在类中 AppenderSkeletonpublic void close()
AsyncAppender by interrupting the dispatcher
thread which will process all pending events before exiting.public java.util.Enumeration getAllAppenders()
getAllAppenders 在接口中 AppenderAttachablepublic Appender getAppender(java.lang.String name)
getAppender 在接口中 AppenderAttachablename - name, may not be null.public boolean getLocationInfo()
public boolean isAttached(Appender appender)
isAttached 在接口中 AppenderAttachableappender - appender.public boolean requiresLayout()
true,
meaning that layout is required, then the configurator will
configure an layout using the configuration information at its
disposal. If this method returns false, meaning that
a layout is not required, then layout configuration will be
skipped even if there is available layout configuration
information at the disposal of the configurator..
In the rather exceptional case, where the appender
implementation admits a layout but can also work without it, then
the appender should return true.
requiresLayout 在接口中 Appenderpublic void removeAllAppenders()
removeAllAppenders 在接口中 AppenderAttachablepublic void removeAppender(Appender appender)
removeAppender 在接口中 AppenderAttachableappender - appender to remove.public void removeAppender(java.lang.String name)
removeAppender 在接口中 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()