log4cplus  1.1.0
Public Member Functions | Protected Member Functions | Protected Attributes
log4cplus::Appender Class Reference

Extend this class for implementing your own strategies for printing log statements. More...

#include <appender.h>

Inheritance diagram for log4cplus::Appender:
[legend]
Collaboration diagram for log4cplus::Appender:
[legend]

List of all members.

Public Member Functions

 Appender ()
 Appender (const log4cplus::helpers::Properties &properties)
virtual ~Appender ()
void destructorImpl ()
virtual void close ()=0
 Release any resources allocated within the appender such as file handles, network connections, etc.
void doAppend (const log4cplus::spi::InternalLoggingEvent &event)
 This method performs threshold checks and invokes filters before delegating actual logging to the subclasses specific append method.
virtual log4cplus::tstring getName ()
 Get the name of this appender.
virtual void setName (const log4cplus::tstring &name)
 Set the name of this appender.
virtual void setErrorHandler (std::auto_ptr< ErrorHandler > eh)
 Set the ErrorHandler for this Appender.
virtual ErrorHandlergetErrorHandler ()
 Return the currently set ErrorHandler for this Appender.
virtual void setLayout (std::auto_ptr< Layout > layout)
 Set the layout for this appender.
virtual LayoutgetLayout ()
 Returns the layout of this appender.
void setFilter (log4cplus::spi::FilterPtr f)
 Set the filter chain on this Appender.
log4cplus::spi::FilterPtr getFilter () const
 Get the filter chain on this Appender.
LogLevel getThreshold () const
 Returns this appenders threshold LogLevel.
void setThreshold (LogLevel th)
 Set the threshold LogLevel.
bool isAsSevereAsThreshold (LogLevel ll) const
 Check whether the message LogLevel is below the appender's threshold.

Protected Member Functions

virtual void append (const log4cplus::spi::InternalLoggingEvent &event)=0
 Subclasses of Appender should implement this method to perform actual logging.
tstringformatEvent (const log4cplus::spi::InternalLoggingEvent &event) const

Protected Attributes

std::auto_ptr< Layoutlayout
 The layout variable does not need to be set if the appender implementation has its own layout.
log4cplus::tstring name
 Appenders are named.
LogLevel threshold
 There is no LogLevel threshold filtering by default.
log4cplus::spi::FilterPtr filter
 The first filter in the filter chain.
std::auto_ptr< ErrorHandlererrorHandler
 It is assumed and enforced that errorHandler is never null.
std::auto_ptr< helpers::LockFilelockFile
 Optional system wide synchronization lock.
bool useLockFile
 Use lock file for inter-process synchronization of access to log file.
bool closed
 Is this appender closed?

Detailed Description

Extend this class for implementing your own strategies for printing log statements.

Properties

layout
This property specifies message layout used by Appender.
See also:
Layout
filters

This property specifies possibly multiple filters used by Appender. Each of multple filters and its properties is under a numbered subkey of filters key. E.g.: filters.1=log4cplus::spi::LogLevelMatchFilter. Filter subkey numbers must be consecutive.

Threshold

This property specifies log level threshold. Events with lower log level than the threshold will not be logged by appender.

UseLockFile
Set this property to true if you want your output through this appender to be synchronized between multiple processes. When this property is set to true then log4cplus uses OS specific facilities (e.g., lockf()) to provide inter-process locking. With the exception of FileAppender and its derived classes, it is also necessary to provide path to a lock file using the LockFile property.
See also:
FileAppender
LockFile
This property specifies lock file, file used for inter-process synchronization of log file access. The property is only used when UseLockFile is set to true. Then it is mandatory.
See also:
FileAppender

Definition at line 129 of file appender.h.


Constructor & Destructor Documentation

virtual log4cplus::Appender::~Appender ( ) [virtual]

Member Function Documentation

virtual void log4cplus::Appender::append ( const log4cplus::spi::InternalLoggingEvent event) [protected, pure virtual]
virtual void log4cplus::Appender::close ( ) [pure virtual]

This method performs threshold checks and invokes filters before delegating actual logging to the subclasses specific append method.

Return the currently set ErrorHandler for this Appender.

Get the filter chain on this Appender.

Definition at line 203 of file appender.h.

virtual Layout* log4cplus::Appender::getLayout ( ) [virtual]

Returns the layout of this appender.

The value may be NULL.

This class owns the returned pointer.

Get the name of this appender.

The name uniquely identifies the appender.

Returns this appenders threshold LogLevel.

See the setThreshold method for the meaning of this option.

Definition at line 209 of file appender.h.

Check whether the message LogLevel is below the appender's threshold.

If there is no threshold set, then the return value is always true.

Definition at line 226 of file appender.h.

References log4cplus::NOT_SET_LOG_LEVEL.

virtual void log4cplus::Appender::setErrorHandler ( std::auto_ptr< ErrorHandler eh) [virtual]

Set the ErrorHandler for this Appender.

Set the filter chain on this Appender.

Definition at line 198 of file appender.h.

virtual void log4cplus::Appender::setLayout ( std::auto_ptr< Layout layout) [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.

virtual void log4cplus::Appender::setName ( const log4cplus::tstring name) [virtual]

Set the name of this appender.

The name is used by other components to identify this appender.

Set the threshold LogLevel.

All log events with lower LogLevel than the threshold LogLevel are ignored by the appender.

In configuration files this option is specified by setting the value of the Threshold option to a LogLevel string, such as "DEBUG", "INFO" and so on.

Definition at line 219 of file appender.h.


Member Data Documentation

bool log4cplus::Appender::closed [protected]

Is this appender closed?

Definition at line 267 of file appender.h.

std::auto_ptr<ErrorHandler> log4cplus::Appender::errorHandler [protected]

It is assumed and enforced that errorHandler is never null.

Definition at line 257 of file appender.h.

The first filter in the filter chain.

Set to null initially.

Definition at line 254 of file appender.h.

std::auto_ptr<Layout> log4cplus::Appender::layout [protected]

The layout variable does not need to be set if the appender implementation has its own layout.

Definition at line 244 of file appender.h.

Optional system wide synchronization lock.

Definition at line 260 of file appender.h.

Appenders are named.

Definition at line 247 of file appender.h.

There is no LogLevel threshold filtering by default.

Definition at line 250 of file appender.h.

Use lock file for inter-process synchronization of access to log file.

Definition at line 264 of file appender.h.


The documentation for this class was generated from the following file: