Apache Log4cxx  Version 2.0.0
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::spi::OptionHandler log4cxx::helpers::Object

Public Member Functions

 OnlyOnceErrorHandler ()
 ~OnlyOnceErrorHandler ()
void error (const LogString &context, const std::exception &e, spi::ErrorCode category=spi::ErrorCode::GENERIC_FAILURE) override
 On the first call to this, writes context and e to stderr .
void error (const LogString &message, spi::ErrorCode category=spi::ErrorCode::INVALID_CONFIGURATION) override
 On the first call to this, writes message to stderr .
bool errorReported () const override
 Has an error been reported?
Public Member Functions inherited from log4cxx::spi::ErrorHandler
virtual ~ErrorHandler ()
virtual void addAppenderHolder (const LogString &name, const AppenderAttachablePtr &clx)
 Override this to add clx to the list of collections to search for the failed appender.
virtual void setLogger (const LoggerPtr &logger)
 Override this to add a reference to a logger to which the failing appender might be attached.
virtual void error (const LogString &context, const std::exception &e, ErrorCode category, const LoggingEventPtr &event)
 This method is invoked when an exception is thown while processing a spi::LoggingEvent.
virtual void setAppender (const AppenderPtr &appender)
 Override this to set the appender holding this error handler.
virtual void setBackupAppender (const AppenderPtr &appender)
 Override this to set the appender to fallback upon in case of failure.
void activateOptions () override
 Activate the options that were previously set with calls to option setters.
void activateOptions (helpers::Pool &)
Public Member Functions inherited from log4cxx::spi::OptionHandler
virtual ~OptionHandler ()
void activateOptions (helpers::Pool &)
virtual void setOption (const LogString &option, const LogString &value)
 Override this method to set option to value.
Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
virtual const helpers::Class & getClass () 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

◆ error() [1/2]

void log4cxx::helpers::OnlyOnceErrorHandler::error ( const LogString & context,
const std::exception & e,
spi::ErrorCode category = spi::ErrorCode::GENERIC_FAILURE )
overridevirtual

On the first call to this, writes context and e to stderr .

Implements log4cxx::spi::ErrorHandler.

◆ error() [2/2]

void log4cxx::helpers::OnlyOnceErrorHandler::error ( const LogString & message,
spi::ErrorCode category = spi::ErrorCode::INVALID_CONFIGURATION )
overridevirtual

On the first call to this, writes message to stderr .

Implements log4cxx::spi::ErrorHandler.

◆ errorReported()

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

Has an error been reported?

Reimplemented from log4cxx::spi::ErrorHandler.


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