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
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | DEFAULT_BUFFER_SIZE | The default buffer size is set to 128 events. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.log4j.AppenderSkeleton
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create new instance.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add appender.
| |||||||||||
Subclasses of
AppenderSkeleton should implement this
method to perform actual logging.
| |||||||||||
Close this
AsyncAppender by interrupting the dispatcher
thread which will process all pending events before exiting. | |||||||||||
Get iterator over attached appenders.
| |||||||||||
Get appender by name.
| |||||||||||
Gets whether appender should block calling thread when buffer is full.
| |||||||||||
Gets the current buffer size.
| |||||||||||
Gets whether the location of the logging request call
should be captured.
| |||||||||||
Determines if specified appender is attached.
| |||||||||||
Removes and closes all attached appenders.
| |||||||||||
Remove appender by name.
| |||||||||||
Removes an appender.
| |||||||||||
Sets whether appender should wait if there is no
space available in the event buffer or immediately return.
| |||||||||||
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.
| |||||||||||
The LocationInfo option takes a boolean value.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.log4j.AppenderSkeleton
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.apache.log4j.Appender
| |||||||||||
From interface
org.apache.log4j.spi.AppenderAttachable
| |||||||||||
From interface
org.apache.log4j.spi.OptionHandler
|
The default buffer size is set to 128 events.
Create new instance.
Add appender.
newAppender | appender to add, may not be null. |
---|
Subclasses of AppenderSkeleton
should implement this
method to perform actual logging. See also AppenderSkeleton.doAppend
method.
Close this AsyncAppender
by interrupting the dispatcher
thread which will process all pending events before exiting.
Get iterator over attached appenders.
Get appender by name.
name | name, may not be null. |
---|
Gets whether appender should block calling thread when buffer is full. If false, messages will be counted by logger and a summary message appended after the contents of the buffer have been appended.
Gets the current buffer size.
Gets whether the location of the logging request call should be captured.
Determines if specified appender is attached.
appender | appender. |
---|
Removes and closes all attached appenders.
Remove appender by name.
name | name. |
---|
Removes an appender.
appender | appender to remove. |
---|
Sets whether appender should wait if there is no space available in the event buffer or immediately return.
value | true if appender should wait until available space in buffer. |
---|
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. Changing the size will not affect messages already in the buffer.
size | buffer size, must be positive. |
---|
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.flag | true if location information should be extracted. |
---|