Apache Log4cxx  Version 2.0.0
Loading...
Searching...
No Matches
log4cxx::spi::LoggerRepository Class Referenceabstract

A LoggerRepository is used to create and retrieve Loggers. More...

#include <loggerrepository.h>

Inheritance diagram for log4cxx::spi::LoggerRepository:
log4cxx::helpers::Object log4cxx::Hierarchy

Public Member Functions

virtual ~LoggerRepository ()
virtual void addHierarchyEventListener (const HierarchyEventListenerPtr &listener)=0
 Add a HierarchyEventListener event to the repository.
virtual void removeHierarchyEventListener (const spi::HierarchyEventListenerPtr &listener)=0
 Remove a previously added HierarchyEventListener from the repository.
virtual void ensureIsConfigured (std::function< void()> configurator)=0
 Call configurator if not yet configured.
virtual bool isDisabled (int level) const =0
 Is the repository disabled for a given level?
virtual void setThreshold (const LevelPtr &level)=0
 Set the repository-wide threshold.
virtual void setThreshold (const LogString &val)=0
 Another form of setThreshold accepting a string parameter instead of a Level.
virtual void emitNoAppenderWarning (const Logger *logger)=0
virtual LevelPtr getThreshold () const =0
 Get the repository-wide threshold.
virtual LoggerPtr getLogger (const LogString &name)=0
 Retrieve the name Logger instance.
virtual LoggerPtr getLogger (const LogString &name, const spi::LoggerFactoryPtr &factory)=0
 Retrieve the name Logger instance.
virtual bool removeLogger (const LogString &name, bool ifNotUsed=true)=0
 Remove the name Logger from the repository.
virtual LoggerPtr getRootLogger () const =0
virtual LoggerPtr exists (const LogString &name)=0
virtual void shutdown ()=0
virtual LoggerList getCurrentLoggers () const =0
virtual void fireAddAppenderEvent (const Logger *logger, const Appender *appender)
virtual void fireRemoveAppenderEvent (const Logger *logger, const Appender *appender)
virtual void resetConfiguration ()=0
virtual bool isConfigured ()=0
virtual void setConfigured (bool configured)=0
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

A LoggerRepository is used to create and retrieve Loggers.

The relation between loggers in a repository depends on the repository but typically loggers are arranged in a named hierarchy.

In addition to the creational methods, a LoggerRepository can be queried for existing loggers, can act as a point of registry for events related to loggers.

Constructor & Destructor Documentation

◆ ~LoggerRepository()

virtual log4cxx::spi::LoggerRepository::~LoggerRepository ( )
inlinevirtual

Member Function Documentation

◆ addHierarchyEventListener()

virtual void log4cxx::spi::LoggerRepository::addHierarchyEventListener ( const HierarchyEventListenerPtr & listener)
pure virtual

Add a HierarchyEventListener event to the repository.

◆ emitNoAppenderWarning()

virtual void log4cxx::spi::LoggerRepository::emitNoAppenderWarning ( const Logger * logger)
pure virtual

Implemented in log4cxx::Hierarchy.

◆ ensureIsConfigured()

virtual void log4cxx::spi::LoggerRepository::ensureIsConfigured ( std::function< void()> configurator)
pure virtual

Call configurator if not yet configured.

Implemented in log4cxx::Hierarchy.

◆ exists()

virtual LoggerPtr log4cxx::spi::LoggerRepository::exists ( const LogString & name)
pure virtual

Implemented in log4cxx::Hierarchy.

◆ fireAddAppenderEvent()

virtual void log4cxx::spi::LoggerRepository::fireAddAppenderEvent ( const Logger * logger,
const Appender * appender )
inlinevirtual

Reimplemented in log4cxx::Hierarchy.

◆ fireRemoveAppenderEvent()

virtual void log4cxx::spi::LoggerRepository::fireRemoveAppenderEvent ( const Logger * logger,
const Appender * appender )
inlinevirtual

Reimplemented in log4cxx::Hierarchy.

◆ getCurrentLoggers()

virtual LoggerList log4cxx::spi::LoggerRepository::getCurrentLoggers ( ) const
pure virtual

Implemented in log4cxx::Hierarchy.

◆ getLogger() [1/2]

virtual LoggerPtr log4cxx::spi::LoggerRepository::getLogger ( const LogString & name)
pure virtual

Retrieve the name Logger instance.

Implemented in log4cxx::Hierarchy.

◆ getLogger() [2/2]

virtual LoggerPtr log4cxx::spi::LoggerRepository::getLogger ( const LogString & name,
const spi::LoggerFactoryPtr & factory )
pure virtual

Retrieve the name Logger instance.

If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated by the provided factory.

Parameters
nameThe name of the logger to retrieve.
factoryThe factory that will make the new logger instance.

Implemented in log4cxx::Hierarchy.

◆ getRootLogger()

virtual LoggerPtr log4cxx::spi::LoggerRepository::getRootLogger ( ) const
pure virtual

Implemented in log4cxx::Hierarchy.

◆ getThreshold()

virtual LevelPtr log4cxx::spi::LoggerRepository::getThreshold ( ) const
pure virtual

Get the repository-wide threshold.

See setThreshold for an explanation.

Implemented in log4cxx::Hierarchy.

◆ isConfigured()

virtual bool log4cxx::spi::LoggerRepository::isConfigured ( )
pure virtual

Implemented in log4cxx::Hierarchy.

◆ isDisabled()

virtual bool log4cxx::spi::LoggerRepository::isDisabled ( int level) const
pure virtual

Is the repository disabled for a given level?

The answer depends on the repository threshold and the level parameter. See also setThreshold method.

Implemented in log4cxx::Hierarchy.

◆ removeHierarchyEventListener()

virtual void log4cxx::spi::LoggerRepository::removeHierarchyEventListener ( const spi::HierarchyEventListenerPtr & listener)
pure virtual

Remove a previously added HierarchyEventListener from the repository.

Implemented in log4cxx::Hierarchy.

◆ removeLogger()

virtual bool log4cxx::spi::LoggerRepository::removeLogger ( const LogString & name,
bool ifNotUsed = true )
pure virtual

Remove the name Logger from the repository.

Note: The name Logger must be retrieved from the repository after any subsequent configuration file change for the newly loaded settings to be used.

Parameters
nameThe logger to remove.
ifNotUsedIf true and use_count() indicates there are other references, do not remove the Logger and return false.
Returns
true if name Logger was removed from the repository.

Implemented in log4cxx::Hierarchy.

◆ resetConfiguration()

virtual void log4cxx::spi::LoggerRepository::resetConfiguration ( )
pure virtual

Implemented in log4cxx::Hierarchy.

◆ setConfigured()

virtual void log4cxx::spi::LoggerRepository::setConfigured ( bool configured)
pure virtual

Implemented in log4cxx::Hierarchy.

◆ setThreshold() [1/2]

virtual void log4cxx::spi::LoggerRepository::setThreshold ( const LevelPtr & level)
pure virtual

Set the repository-wide threshold.

All logging requests below the threshold are immediately dropped. By default, the threshold is set to Level::getAll() which has the lowest possible rank.

Implemented in log4cxx::Hierarchy.

◆ setThreshold() [2/2]

virtual void log4cxx::spi::LoggerRepository::setThreshold ( const LogString & val)
pure virtual

Another form of setThreshold accepting a string parameter instead of a Level.

Implemented in log4cxx::Hierarchy.

◆ shutdown()

virtual void log4cxx::spi::LoggerRepository::shutdown ( )
pure virtual

Implemented in log4cxx::Hierarchy.


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