Apache log4cxx Version @version@
OnlyOnceErrorHandler Class Reference

The OnlyOnceErrorHandler implements log4cxx's default error handling policy which consists of emitting a message for the first error in an appender and ignoring all following errors. More...

#include <onlyonceerrorhandler.h>

Inheritance diagram for OnlyOnceErrorHandler:
ErrorHandler ObjectImpl OptionHandler Object Object

Public Member Functions

 OnlyOnceErrorHandler ()
 
void addRef () const
 
void releaseRef () const
 
void setLogger (const LoggerPtr &logger)
 Does not do anything. More...
 
void activateOptions (log4cxx::helpers::Pool &p)
 No options to activate. More...
 
void setOption (const LogString &option, const LogString &value)
 Set option to value. More...
 
void error (const LogString &message, const std::exception &e, int errorCode) const
 Prints the message and the stack trace of the exception on System.err. More...
 
void error (const LogString &message, const std::exception &e, int errorCode, const spi::LoggingEventPtr &event) const
 Prints the message and the stack trace of the exception on System.err. More...
 
void error (const LogString &message) const
 Print a the error message passed as parameter on System.err. More...
 
void setAppender (const AppenderPtr &appender)
 Does not do anything. More...
 
void setBackupAppender (const AppenderPtr &appender)
 Does not do anything. More...
 
- Public Member Functions inherited from ErrorHandler
virtual ~ErrorHandler ()
 
virtual void setLogger (const LoggerPtr &logger)=0
 Add a reference to a logger to which the failing appender might be attached to. More...
 
virtual void error (const LogString &message, const std::exception &e, int errorCode) const =0
 Equivalent to the error(const String&, helpers::Exception&, int, spi::LoggingEvent&) with the the event parameteter set to null. More...
 
virtual void error (const LogString &message) const =0
 This method is normally used to just print the error message passed as a parameter. More...
 
virtual void error (const LogString &message, const std::exception &e, int errorCode, const LoggingEventPtr &event) const =0
 This method is invoked to handle the error. More...
 
virtual void setAppender (const AppenderPtr &appender)=0
 Set the appender for which errors are handled. More...
 
virtual void setBackupAppender (const AppenderPtr &appender)=0
 Set the appender to fallback upon in case of failure. More...
 
- Public Member Functions inherited from OptionHandler
virtual ~OptionHandler ()
 
virtual void activateOptions (log4cxx::helpers::Pool &p)=0
 Activate the options that were previously set with calls to option setters. More...
 
virtual void setOption (const LogString &option, const LogString &value)=0
 Set option to value. More...
 
- Public Member Functions inherited from Object
virtual const helpers::ClassgetClass () const
 
virtual ~Object ()
 
virtual void addRef () const =0
 
virtual void releaseRef () const =0
 
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 
- Public Member Functions inherited from ObjectImpl
 ObjectImpl ()
 
virtual ~ObjectImpl ()
 
void addRef () const
 
void releaseRef () const
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static const helpers::ClassgetStaticClass ()
 
static const log4cxx::helpers::ClassRegistrationregisterClass ()
 
- Protected Attributes inherited from ObjectImpl
unsigned int volatile ref
 

Detailed Description

The OnlyOnceErrorHandler implements log4cxx's default error handling policy which consists of emitting a message for the first error in an appender and ignoring all following errors.

The error message is printed on System.err.

This policy aims at protecting an otherwise working application from being flooded with error messages when logging fails

Constructor & Destructor Documentation

◆ OnlyOnceErrorHandler()

Member Function Documentation

◆ activateOptions()

void activateOptions ( log4cxx::helpers::Pool p)
virtual

No options to activate.

Implements OptionHandler.

◆ addRef()

void addRef ( ) const
virtual

Reimplemented from ObjectImpl.

◆ error() [1/3]

void error ( const LogString message) const
virtual

Print a the error message passed as parameter on System.err.

Implements ErrorHandler.

◆ error() [2/3]

void error ( const LogString message,
const std::exception &  e,
int  errorCode 
) const
virtual

Prints the message and the stack trace of the exception on System.err.


Implements ErrorHandler.

◆ error() [3/3]

void error ( const LogString message,
const std::exception &  e,
int  errorCode,
const spi::LoggingEventPtr event 
) const
virtual

Prints the message and the stack trace of the exception on System.err.

Implements ErrorHandler.

◆ releaseRef()

void releaseRef ( ) const
virtual

Reimplemented from ObjectImpl.

◆ setAppender()

void setAppender ( const AppenderPtr appender)
virtual

Does not do anything.

Implements ErrorHandler.

◆ setBackupAppender()

void setBackupAppender ( const AppenderPtr appender)
virtual

Does not do anything.

Implements ErrorHandler.

◆ setLogger()

void setLogger ( const LoggerPtr logger)
virtual

Does not do anything.

Implements ErrorHandler.

◆ setOption()

void setOption ( const LogString option,
const LogString value 
)
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.


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