Apache Log4cxx  Version 1.3.1
Loading...
Searching...
No Matches
log4cxx::helpers::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 log4cxx::helpers::OnlyOnceErrorHandler:
log4cxx::spi::ErrorHandler log4cxx::helpers::Object log4cxx::spi::OptionHandler log4cxx::helpers::Object

Public Member Functions

 OnlyOnceErrorHandler ()
 
 ~OnlyOnceErrorHandler ()
 
void setLogger (const LoggerPtr &logger) override
 Does not do anything.
 
void activateOptions (helpers::Pool &p) override
 Activate the options that were previously set with calls to option setters.
 
void setOption (const LogString &option, const LogString &value) override
 Set option to value.
 
void error (const LogString &message, const std::exception &e, int errorCode) const override
 Prints the message and the stack trace of the exception on System.err.
 
void error (const LogString &message, const std::exception &e, int errorCode, const spi::LoggingEventPtr &event) const override
 Prints the message and the stack trace of the exception on System.err.
 
void error (const LogString &message) const override
 Print a the error message passed as parameter on System.err.
 
void setAppender (const AppenderPtr &appender) override
 Does not do anything.
 
void setBackupAppender (const AppenderPtr &appender) override
 Does not do anything.
 
bool errorReported () const
 Has an error been reported?
 
- Public Member Functions inherited from log4cxx::spi::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.
 
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.
 
virtual void error (const LogString &message) const =0
 This method is normally used to just print the error message passed as a parameter.
 
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.
 
virtual void setAppender (const AppenderPtr &appender)=0
 Set the appender for which errors are handled.
 
virtual void setBackupAppender (const AppenderPtr &appender)=0
 Set the appender to fallback upon in case of failure.
 
- Public Member Functions inherited from log4cxx::spi::OptionHandler
virtual ~OptionHandler ()
 
virtual void activateOptions (helpers::Pool &p)=0
 Activate the options that were previously set with calls to option setters.
 
virtual void setOption (const LogString &option, const LogString &value)=0
 Set option to value.
 
- Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
 
virtual const helpers::ClassgetClass () const =0
 
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 

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()

log4cxx::helpers::OnlyOnceErrorHandler::OnlyOnceErrorHandler ( )

◆ ~OnlyOnceErrorHandler()

log4cxx::helpers::OnlyOnceErrorHandler::~OnlyOnceErrorHandler ( )

Member Function Documentation

◆ activateOptions()

void log4cxx::helpers::OnlyOnceErrorHandler::activateOptions ( helpers::Pool p)
overridevirtual

Activate the options that were previously set with calls to option setters.

No action is performed in this implementation.

Implements log4cxx::spi::OptionHandler.

◆ error() [1/3]

void log4cxx::helpers::OnlyOnceErrorHandler::error ( const LogString message) const
overridevirtual

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

Implements log4cxx::spi::ErrorHandler.

◆ error() [2/3]

void log4cxx::helpers::OnlyOnceErrorHandler::error ( const LogString message,
const std::exception &  e,
int  errorCode 
) const
overridevirtual

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


Implements log4cxx::spi::ErrorHandler.

◆ error() [3/3]

void log4cxx::helpers::OnlyOnceErrorHandler::error ( const LogString message,
const std::exception &  e,
int  errorCode,
const spi::LoggingEventPtr event 
) const
overridevirtual

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

Implements log4cxx::spi::ErrorHandler.

◆ errorReported()

bool log4cxx::helpers::OnlyOnceErrorHandler::errorReported ( ) const

Has an error been reported?

◆ setAppender()

void log4cxx::helpers::OnlyOnceErrorHandler::setAppender ( const AppenderPtr appender)
overridevirtual

Does not do anything.

Implements log4cxx::spi::ErrorHandler.

◆ setBackupAppender()

void log4cxx::helpers::OnlyOnceErrorHandler::setBackupAppender ( const AppenderPtr appender)
overridevirtual

Does not do anything.

Implements log4cxx::spi::ErrorHandler.

◆ setLogger()

void log4cxx::helpers::OnlyOnceErrorHandler::setLogger ( const LoggerPtr logger)
overridevirtual

Does not do anything.

Implements log4cxx::spi::ErrorHandler.

◆ setOption()

void log4cxx::helpers::OnlyOnceErrorHandler::setOption ( const LogString option,
const LogString value 
)
overridevirtual

Set option to value.

Supported options Supported values Default value
- - -

Implements log4cxx::spi::OptionHandler.


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