Public Member Functions | |
void | finalize () |
void | activateOptions () |
void | setOption (const String &name, const String &value) |
void | addFilter (const spi::FilterPtr &newFilter) |
void | clearFilters () |
const spi::ErrorHandlerPtr & | getErrorHandler () const |
const spi::FilterPtr & | getFilter () const |
const spi::FilterPtr & | getFirstFilter () const |
const LayoutPtr & | getLayout () const |
const String & | getName () const |
const LevelPtr & | getThreshold () |
bool | isAsSevereAsThreshold (const LevelPtr &level) const |
void | doAppend (const spi::LoggingEventPtr &event) |
void | setErrorHandler (const spi::ErrorHandlerPtr &eh) |
void | setLayout (const LayoutPtr &layout) |
void | setName (const String &name) |
void | setThreshold (const LevelPtr &threshold) |
Protected Member Functions | |
virtual void | append (const spi::LoggingEventPtr &event)=0 |
Protected Attributes | |
LayoutPtr | layout |
String | name |
LevelPtr | threshold |
spi::ErrorHandlerPtr | errorHandler |
spi::FilterPtr | headFilter |
spi::FilterPtr | tailFilter |
bool | closed |
This class provides the code for common functionality, such as support for threshold filtering and support for general filters.
void finalize | ( | ) |
Finalize this appender by calling the derived class' close
method.
void activateOptions | ( | ) | [inline, virtual] |
Derived appenders should override this method if option structure requires it.
Implements OptionHandler.
Reimplemented in ConsoleAppender, DailyRollingFileAppender, FileAppender, SMTPAppender, SocketAppender, SocketHubAppender, SyslogAppender, TelnetAppender, XMLSocketAppender, and NTEventLogAppender.
void setOption | ( | const String & | name, | |
const String & | value | |||
) | [inline, virtual] |
Set option
to value
.
The handling of each option depends on the OptionHandler instance. Some options may become active immediately whereas other may be activated only when activateOptions is called.
Implements OptionHandler.
Reimplemented in ConsoleAppender, DailyRollingFileAppender, ODBCAppender, FileAppender, SMTPAppender, SocketAppender, SocketHubAppender, SyslogAppender, TelnetAppender, XMLSocketAppender, NTEventLogAppender, and RollingFileAppender.
void addFilter | ( | const spi::FilterPtr & | newFilter | ) | [virtual] |
Add a filter to end of the filter list.
Implements Appender.
virtual void append | ( | const spi::LoggingEventPtr & | event | ) | [protected, pure virtual] |
Subclasses of AppenderSkeleton
should implement this method to perform actual logging. See also AppenderSkeleton::doAppend method.
Implemented in AsyncAppender, ODBCAppender, SMTPAppender, SocketAppender, SocketHubAppender, SyslogAppender, TelnetAppender, XMLSocketAppender, NTEventLogAppender, and WriterAppender.
void clearFilters | ( | ) | [virtual] |
Clear the filters chain.
Implements Appender.
const spi::ErrorHandlerPtr& getErrorHandler | ( | ) | const [inline, virtual] |
Return the currently set spi::ErrorHandler for this Appender.
Implements Appender.
const spi::FilterPtr& getFilter | ( | ) | const [inline, virtual] |
Returns the head Filter.
Implements Appender.
const spi::FilterPtr& getFirstFilter | ( | ) | const [inline] |
Return the first filter in the filter chain for this Appender. The return value may be 0
if no is filter is set.
const LayoutPtr& getLayout | ( | ) | const [inline, virtual] |
Returns the layout of this appender. The value may be 0.
Implements Appender.
const String& getName | ( | ) | const [inline, virtual] |
const LevelPtr& getThreshold | ( | ) | [inline] |
Returns this appenders threshold level. See the setThreshold method for the meaning of this option.
bool isAsSevereAsThreshold | ( | const LevelPtr & | level | ) | const |
Check whether the message level is below the appender's threshold. If there is no threshold set, then the return value is always true
.
void doAppend | ( | const spi::LoggingEventPtr & | event | ) | [virtual] |
This method performs threshold checks and invokes filters before delegating actual logging to the subclasses specific AppenderSkeleton::append method.
Implements Appender.
void setErrorHandler | ( | const spi::ErrorHandlerPtr & | eh | ) | [virtual] |
Set the ErrorHandler for this Appender.
Implements Appender.
void setLayout | ( | const LayoutPtr & | layout | ) | [inline, virtual] |
Set the layout for this appender. Note that some appenders have their own (fixed) layouts or do not use one. For example, the SocketAppender ignores the layout set here.
Implements Appender.
void setName | ( | const String & | name | ) | [inline, virtual] |
void setThreshold | ( | const LevelPtr & | threshold | ) |
Set the threshold level. All log events with lower level than the threshold level are ignored by the appender.
In configuration files this option is specified by setting the value of the Threshold option to a level string, such as "DEBUG", "INFO" and so on.
The layout variable does not need to be set if the appender implementation has its own layout.
String name [protected] |
Appenders are named.
spi::ErrorHandlerPtr errorHandler [protected] |
It is assumed and enforced that errorHandler is never null.
spi::FilterPtr headFilter [protected] |
The first filter in the filter chain. Set to null
initially.
spi::FilterPtr tailFilter [protected] |
The last filter in the filter chain.
bool closed [protected] |
Is this appender closed?