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.
Important note: The AsyncAppender
can only be script configured using the DOMConfigurator.
Public Member Functions | |
AsyncAppender () | |
Create new instance. | |
virtual | ~AsyncAppender () |
Destructor. | |
void | addRef () const |
void | releaseRef () const |
void | addAppender (const AppenderPtr &newAppender) |
Add appender. | |
void | append (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &p) |
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. | |
AppenderList | getAllAppenders () const |
Get iterator over attached appenders. | |
AppenderPtr | getAppender (const LogString &name) const |
Get appender by name. | |
bool | getLocationInfo () const |
Gets whether the location of the logging request call should be captured. | |
bool | isAttached (const AppenderPtr &appender) const |
Determines if specified appender is attached. | |
virtual bool | requiresLayout () const |
Configurators call this method to determine if the appender requires a layout. | |
void | removeAllAppenders () |
Removes and closes all attached appenders. | |
void | removeAppender (const AppenderPtr &appender) |
Removes an appender. | |
void | removeAppender (const LogString &name) |
Remove appender by name. | |
void | setLocationInfo (bool flag) |
The LocationInfo attribute is provided for compatibility with log4j and has no effect on the log output. | |
void | setBufferSize (int size) |
The BufferSize option takes a non-negative integer value. | |
int | getBufferSize () const |
Gets the current buffer size. | |
void | setBlocking (bool value) |
Sets whether appender should wait if there is no space available in the event buffer or immediately return. | |
bool | getBlocking () const |
Gets whether appender should block calling thread when buffer is full. | |
void | setOption (const LogString &option, const LogString &value) |
Set appender properties by name. | |
Classes | |
class | DiscardSummary |
|
Create new instance.
|
|
Destructor.
|
|
Add appender.
Implements AppenderAttachable. |
|
Reimplemented from AppenderSkeleton. |
|
Subclasses of See also AppenderSkeleton::doAppend method. Implements AppenderSkeleton. |
|
Close this
Implements Appender. |
|
Get iterator over attached appenders.
Implements AppenderAttachable. |
|
Get appender by name.
Implements AppenderAttachable. |
|
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.
Implements AppenderAttachable. |
|
Reimplemented from AppenderSkeleton. |
|
Removes and closes all attached appenders.
Implements AppenderAttachable. |
|
Remove appender by name.
Implements AppenderAttachable. |
|
Removes an appender.
Implements AppenderAttachable. |
|
Configurators call this method to determine if the appender requires a layout.
If this method returns
In the rather exceptional case, where the appender implementation admits a layout but can also work without it, then the appender should return Implements Appender. |
|
Sets whether appender should wait if there is no space available in the event buffer or immediately return.
|
|
The BufferSize option takes a non-negative integer value. This integer value determines the maximum size of the bounded buffer. |
|
The LocationInfo attribute is provided for compatibility with log4j and has no effect on the log output.
|
|
Set appender properties by name.
Reimplemented from AppenderSkeleton. |