Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

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:

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

Collaboration graph
[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 AppenderSkeleton#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 AppenderSkeleton should implement this method to perform actual logging.


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.

bool closed
 Is this appender closed?


Detailed Description

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

Definition at line 63 of file appender.h.


Constructor & Destructor Documentation

log4cplus::Appender::Appender  ) 
 

log4cplus::Appender::Appender const log4cplus::helpers::Properties  properties  ) 
 

virtual log4cplus::Appender::~Appender  )  [inline, virtual]
 

Definition at line 73 of file appender.h.


Member Function Documentation

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

Subclasses of AppenderSkeleton should implement this method to perform actual logging.

See also AppenderSkeleton.doAppend method.

Implemented in log4cplus::NullAppender.

virtual void log4cplus::Appender::close  )  [pure virtual]
 

Release any resources allocated within the appender such as file handles, network connections, etc.

It is a programming error to append to a closed appender.

Implemented in log4cplus::ConsoleAppender, log4cplus::FileAppender, log4cplus::DailyRollingFileAppender, log4cplus::NullAppender, and log4cplus::SocketAppender.

void log4cplus::Appender::destructorImpl  ) 
 

void log4cplus::Appender::doAppend const log4cplus::spi::InternalLoggingEvent event  ) 
 

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

virtual ErrorHandler* log4cplus::Appender::getErrorHandler  )  [virtual]
 

Return the currently set ErrorHandler for this Appender.

log4cplus::spi::FilterPtr log4cplus::Appender::getFilter  )  const [inline]
 

Get the filter chain on this Appender.

Definition at line 138 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.

virtual log4cplus::tstring log4cplus::Appender::getName  )  [virtual]
 

Get the name of this appender.

The name uniquely identifies the appender.

LogLevel log4cplus::Appender::getThreshold  )  const [inline]
 

Returns this appenders threshold LogLevel.

See the setThreshold method for the meaning of this option.

Definition at line 144 of file appender.h.

References log4cplus::LogLevel.

bool log4cplus::Appender::isAsSevereAsThreshold LogLevel  ll  )  const [inline]
 

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 161 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.

void log4cplus::Appender::setFilter log4cplus::spi::FilterPtr  f  )  [inline]
 

Set the filter chain on this Appender.

Definition at line 133 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.

void log4cplus::Appender::setThreshold LogLevel  th  )  [inline]
 

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 154 of file appender.h.


Member Data Documentation

bool log4cplus::Appender::closed [protected]
 

Is this appender closed?

Definition at line 193 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 190 of file appender.h.

log4cplus::spi::FilterPtr log4cplus::Appender::filter [protected]
 

The first filter in the filter chain.

Set to null initially.

Definition at line 187 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 177 of file appender.h.

log4cplus::tstring log4cplus::Appender::name [protected]
 

Appenders are named.

Definition at line 180 of file appender.h.

LogLevel log4cplus::Appender::threshold [protected]
 

There is no LogLevel threshold filtering by default.

Definition at line 183 of file appender.h.


The documentation for this class was generated from the following file:
Generated on Mon Feb 9 09:10:41 2004 for log4cplus by doxygen 1.3.2