Inherits log4cxx::spi::AppenderAttachable, and log4cxx::AppenderSkeleton.
Classes | |
class | DiscardSummary |
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. |
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.
AsyncAppender | ( | ) |
Create new instance.
virtual ~AsyncAppender | ( | ) | [virtual] |
Destructor.
void addAppender | ( | const AppenderPtr & | newAppender | ) | [virtual] |
Add appender.
newAppender | appender to add, may not be null. |
Implements AppenderAttachable.
void addRef | ( | ) | const [virtual] |
Reimplemented from AppenderSkeleton.
void append | ( | const spi::LoggingEventPtr & | event, | |
log4cxx::helpers::Pool & | p | |||
) | [virtual] |
Subclasses of AppenderSkeleton
should implement this method to perform actual logging.
See also AppenderSkeleton::doAppend method.
Implements AppenderSkeleton.
void close | ( | ) | [virtual] |
Close this AsyncAppender
by interrupting the dispatcher thread which will process all pending events before exiting.
Implements Appender.
AppenderList getAllAppenders | ( | ) | const [virtual] |
Get iterator over attached appenders.
Implements AppenderAttachable.
AppenderPtr getAppender | ( | const LogString & | name | ) | const [virtual] |
Get appender by name.
name | name, may not be null. |
Implements AppenderAttachable.
bool getBlocking | ( | ) | const |
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.
int getBufferSize | ( | ) | const |
Gets the current buffer size.
bool getLocationInfo | ( | ) | const |
Gets whether the location of the logging request call should be captured.
bool isAttached | ( | const AppenderPtr & | appender | ) | const [virtual] |
Determines if specified appender is attached.
appender | appender. |
Implements AppenderAttachable.
void releaseRef | ( | ) | const [virtual] |
Reimplemented from AppenderSkeleton.
void removeAllAppenders | ( | ) | [virtual] |
void removeAppender | ( | const LogString & | name | ) | [virtual] |
void removeAppender | ( | const AppenderPtr & | appender | ) | [virtual] |
virtual bool requiresLayout | ( | ) | const [virtual] |
Configurators call this method to determine if the appender requires a layout.
If this method returns 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
.
Implements Appender.
void setBlocking | ( | bool | value | ) |
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. |
void setBufferSize | ( | int | size | ) |
The BufferSize option takes a non-negative integer value.
This integer value determines the maximum size of the bounded buffer.
void setLocationInfo | ( | bool | flag | ) |
The LocationInfo attribute is provided for compatibility with log4j and has no effect on the log output.
flag | new value. |
Set appender properties by name.
option | property name. | |
value | property value. |
Reimplemented from AppenderSkeleton.