Apache log4cxx  Version 0.13.0
log4cxx::AppenderSkeleton Class Referenceabstract

Implementation base class for all appenders. More...

#include <appenderskeleton.h>

Inheritance diagram for log4cxx::AppenderSkeleton:
log4cxx::Appender log4cxx::helpers::Object log4cxx::spi::OptionHandler log4cxx::helpers::Object log4cxx::AsyncAppender log4cxx::db::ODBCAppender log4cxx::net::SMTPAppender log4cxx::net::SocketAppenderSkeleton log4cxx::net::SocketHubAppender log4cxx::net::SyslogAppender log4cxx::net::TelnetAppender log4cxx::nt::NTEventLogAppender log4cxx::nt::OutputDebugStringAppender log4cxx::WriterAppender

Public Member Functions

 AppenderSkeleton ()
 
 AppenderSkeleton (const LayoutPtr &layout)
 
void finalize ()
 Finalize this appender by calling the derived class' close method. More...
 
virtual void activateOptions (log4cxx::helpers::Pool &)
 Derived appenders should override this method if option structure requires it. More...
 
virtual void setOption (const LogString &option, const LogString &value)
 Set option to value. More...
 
void addFilter (const spi::FilterPtr &newFilter)
 Add a filter to end of the filter list. More...
 
void clearFilters ()
 Clear the filters chain. More...
 
const spi::ErrorHandlerPtrgetErrorHandler () const
 Return the currently set spi::ErrorHandler for this Appender. More...
 
spi::FilterPtr getFilter () const
 Returns the head Filter. More...
 
const spi::FilterPtrgetFirstFilter () const
 Return the first filter in the filter chain for this Appender. More...
 
LayoutPtr getLayout () const
 Returns the layout of this appender. More...
 
LogString getName () const
 Returns the name of this Appender. More...
 
const LevelPtrgetThreshold () const
 Returns this appenders threshold level. More...
 
bool isAsSevereAsThreshold (const LevelPtr &level) const
 Check whether the message level is below the appender's threshold. More...
 
virtual void doAppend (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool)
 This method performs threshold checks and invokes filters before delegating actual logging to the subclasses specific AppenderSkeleton::append method. More...
 
void setErrorHandler (const spi::ErrorHandlerPtr eh)
 Set the ErrorHandler for this Appender. More...
 
void setLayout (const LayoutPtr &layout1)
 Set the layout for this appender. More...
 
void setName (const LogString &name1)
 Set the name of this Appender. More...
 
void setThreshold (const LevelPtr &threshold)
 Set the threshold level. More...
 
- Public Member Functions inherited from log4cxx::Appender
virtual ~Appender ()
 
void asdf ()
 
virtual void close ()=0
 Release any resources allocated within the appender such as file handles, network connections, etc. More...
 
virtual bool requiresLayout () const =0
 Configurators call this method to determine if the appender requires a layout. More...
 
- Public Member Functions inherited from log4cxx::spi::OptionHandler
virtual ~OptionHandler ()
 
- Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
 
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 

Protected Member Functions

virtual void append (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &p)=0
 Subclasses of AppenderSkeleton should implement this method to perform actual logging. More...
 
void doAppendImpl (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool)
 

Protected Attributes

LayoutPtr layout
 The layout variable does not need to be set if the appender implementation has its own layout. More...
 
LogString name
 Appenders are named. More...
 
LevelPtr threshold
 There is no level threshold filtering by default. More...
 
spi::ErrorHandlerPtr errorHandler
 It is assumed and enforced that errorHandler is never null. More...
 
spi::FilterPtr headFilter
 The first filter in the filter chain. More...
 
spi::FilterPtr tailFilter
 The last filter in the filter chain. More...
 
bool closed
 Is this appender closed? More...
 
log4cxx::helpers::Pool pool
 
std::recursive_mutex mutex
 

Detailed Description

Implementation base class for all appenders.

This class provides the code for common functionality, such as support for threshold filtering and support for general filters.

Constructor & Destructor Documentation

◆ AppenderSkeleton() [1/2]

log4cxx::AppenderSkeleton::AppenderSkeleton ( )

◆ AppenderSkeleton() [2/2]

log4cxx::AppenderSkeleton::AppenderSkeleton ( const LayoutPtr layout)

Member Function Documentation

◆ activateOptions()

◆ addFilter()

void log4cxx::AppenderSkeleton::addFilter ( const spi::FilterPtr newFilter)
virtual

Add a filter to end of the filter list.

Implements log4cxx::Appender.

◆ append()

◆ clearFilters()

void log4cxx::AppenderSkeleton::clearFilters ( )
virtual

Clear the filters chain.

Implements log4cxx::Appender.

◆ doAppend()

virtual void log4cxx::AppenderSkeleton::doAppend ( const spi::LoggingEventPtr event,
log4cxx::helpers::Pool pool 
)
virtual

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

Implements log4cxx::Appender.

Reimplemented in log4cxx::AsyncAppender.

◆ doAppendImpl()

void log4cxx::AppenderSkeleton::doAppendImpl ( const spi::LoggingEventPtr event,
log4cxx::helpers::Pool pool 
)
protected

◆ finalize()

void log4cxx::AppenderSkeleton::finalize ( )

Finalize this appender by calling the derived class' close method.

◆ getErrorHandler()

const spi::ErrorHandlerPtr& log4cxx::AppenderSkeleton::getErrorHandler ( ) const
inline

Return the currently set spi::ErrorHandler for this Appender.

◆ getFilter()

spi::FilterPtr log4cxx::AppenderSkeleton::getFilter ( ) const
inlinevirtual

Returns the head Filter.

Implements log4cxx::Appender.

◆ getFirstFilter()

const spi::FilterPtr& log4cxx::AppenderSkeleton::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.

◆ getLayout()

LayoutPtr log4cxx::AppenderSkeleton::getLayout ( ) const
inlinevirtual

Returns the layout of this appender.

The value may be 0.

Implements log4cxx::Appender.

◆ getName()

LogString log4cxx::AppenderSkeleton::getName ( ) const
inlinevirtual

Returns the name of this Appender.

Implements log4cxx::Appender.

◆ getThreshold()

const LevelPtr& log4cxx::AppenderSkeleton::getThreshold ( ) const
inline

Returns this appenders threshold level.

See the setThreshold method for the meaning of this option.

◆ isAsSevereAsThreshold()

bool log4cxx::AppenderSkeleton::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.

◆ setErrorHandler()

void log4cxx::AppenderSkeleton::setErrorHandler ( const spi::ErrorHandlerPtr  eh)

Set the ErrorHandler for this Appender.

◆ setLayout()

void log4cxx::AppenderSkeleton::setLayout ( const LayoutPtr layout1)
inlinevirtual

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 log4cxx::Appender.

◆ setName()

void log4cxx::AppenderSkeleton::setName ( const LogString name1)
inlinevirtual

Set the name of this Appender.

Implements log4cxx::Appender.

◆ setOption()

virtual void log4cxx::AppenderSkeleton::setOption ( const LogString option,
const LogString value 
)
virtual

◆ setThreshold()

void log4cxx::AppenderSkeleton::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.

Member Data Documentation

◆ closed

bool log4cxx::AppenderSkeleton::closed
protected

Is this appender closed?

◆ errorHandler

spi::ErrorHandlerPtr log4cxx::AppenderSkeleton::errorHandler
protected

It is assumed and enforced that errorHandler is never null.

◆ headFilter

spi::FilterPtr log4cxx::AppenderSkeleton::headFilter
protected

The first filter in the filter chain.

Set to null initially.

◆ layout

LayoutPtr log4cxx::AppenderSkeleton::layout
protected

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

◆ mutex

std::recursive_mutex log4cxx::AppenderSkeleton::mutex
mutableprotected

◆ name

LogString log4cxx::AppenderSkeleton::name
protected

Appenders are named.

◆ pool

log4cxx::helpers::Pool log4cxx::AppenderSkeleton::pool
protected

◆ tailFilter

spi::FilterPtr log4cxx::AppenderSkeleton::tailFilter
protected

The last filter in the filter chain.

◆ threshold

LevelPtr log4cxx::AppenderSkeleton::threshold
protected

There is no level threshold filtering by default.


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