Apache Log4cxx  Version 2.0.0
Loading...
Searching...
No Matches
log4cxx::spi::RootLogger Class Reference

RootLogger sits at the top of the logger hierachy. More...

#include <rootlogger.h>

Inheritance diagram for log4cxx::spi::RootLogger:
log4cxx::Logger log4cxx::spi::AppenderAttachable log4cxx::helpers::Object

Public Member Functions

 RootLogger (const LevelPtr &level)
 The root logger names itself as "root".
 ~RootLogger ()
virtual LevelPtr getEffectiveLevel () const
 Return the assigned level value without walking the logger hierarchy.
void setLevel (const LevelPtr &level)
 Setting a null value to the level of the root logger may have catastrophic results.
Public Member Functions inherited from log4cxx::Logger
 Logger (const LogString &name)
 This constructor initializes a new logger instance and sets its name.
 ~Logger ()
void addAppender (const AppenderPtr &newAppender) override
 Add newAppender to the list of appenders of this Logger instance.
void callAppenders (const spi::LoggingEventPtr &event) const
 Send event to all appenders attached to this or attached to a parent of this.
void closeNestedAppenders ()
 Close all attached appenders implementing the AppenderAttachable interface.
void debug (const std::string &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg and location to attached appender(s) if this logger is enabled for DEBUG events.
void debug (const std::wstring &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg and location to attached appender(s) if this logger is enabled for DEBUG events.
void debug (const CFStringRef &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg and location to attached appender(s) if this logger is enabled for DEBUG events.
void error (const std::string &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg and location to attached appender(s) if this logger is enabled for ERROR events.
void error (const std::wstring &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg and location to attached appender(s) if this logger is enabled for ERROR events.
void error (const CFStringRef &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg and location to attached appender(s) if this logger is enabled for ERROR events.
void fatal (const std::string &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg and location to attached appender(s) if this logger is enabled for FATAL events.
void fatal (const std::wstring &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg and location to attached appender(s) if this logger is enabled for FATAL events.
void fatal (const CFStringRef &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg and location to attached appender(s) if this logger is enabled for FATAL events.
void addEvent (const LevelPtr &level, std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing message and location to attached appender(s) without further checks.
void addEvent (const LevelPtr &level, helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add to attached appender(s) a new level LoggingEvent which was requested at sourceLocation where the message is built asynchronously by messageAppender without further checks.
void addFatalEvent (std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new fatal level logging event containing message and location to attached appender(s) without further checks.
void addFatalEvent (helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add to attached appender(s) a new FATAL level LoggingEvent which was requested at sourceLocation where the message is built asynchronously by messageAppender without further checks.
void addErrorEvent (std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new error level logging event containing message and location to attached appender(s) without further checks.
void addErrorEvent (helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add to attached appender(s) a new ERROR level LoggingEvent which was requested at sourceLocation where the message is built asynchronously by messageAppender without further checks.
void addWarnEvent (std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new warning level logging event containing message and location to attached appender(s) without further checks.
void addWarnEvent (helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add to attached appender(s) a new WARN level LoggingEvent which was requested at sourceLocation where the message is built asynchronously by messageAppender without further checks.
void addInfoEvent (std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new info level logging event containing message and location to attached appender(s) without further checks.
void addInfoEvent (helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add to attached appender(s) a new INFO level LoggingEvent which was requested at sourceLocation where the message is built asynchronously by messageAppender without further checks.
void addDebugEvent (std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new debug level logging event containing message and location to attached appender(s) without further checks.
void addDebugEvent (helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add to attached appender(s) a new DEBUG level LoggingEvent which was requested at sourceLocation where the message is built asynchronously by messageAppender without further checks.
void addTraceEvent (std::string &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new trace level logging event containing message and location to attached appender(s) without further checks.
void addTraceEvent (helpers::AsyncBuffer &&messageAppender, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add to attached appender(s) a new TRACE level LoggingEvent which was requested at sourceLocation where the message is built asynchronously by messageAppender without further checks.
void forcedLog (const LevelPtr &level, const std::string &message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing message and location to attached appender(s) without further checks.
void addEvent (const LevelPtr &level, std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing message and location to attached appender(s) without further checks.
void addFatalEvent (std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new fatal level logging event containing message and location to attached appender(s) without further checks.
void addErrorEvent (std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new error level logging event containing message and location to attached appender(s) without further checks.
void addWarnEvent (std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new warning level logging event containing message and location to attached appender(s) without further checks.
void addInfoEvent (std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new info level logging event containing message and location to attached appender(s) without further checks.
void addDebugEvent (std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new debug level logging event containing message and location to attached appender(s) without further checks.
void addTraceEvent (std::wstring &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new trace level logging event containing message and location to attached appender(s) without further checks.
void forcedLog (const LevelPtr &level, const std::wstring &message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing message and location to attached appender(s) without further checks.
void forcedLog (const LevelPtr &level, const CFStringRef &message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing message and location to attached appender(s) without further checks.
void addEventLS (const LevelPtr &level, LogString &&message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing message and location to attached appender(s) without further checks.
void forcedLogLS (const LevelPtr &level, const LogString &message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing message and location to attached appender(s) without further checks.
bool getAdditivity () const
 Get the additivity flag for this logger.
AppenderList getAllAppenders () const override
 Get the appenders contained in this logger as an AppenderList.
AppenderPtr getAppender (const LogString &name) const override
 Look for the appender named as name.
const LogString & getName () const
 Get the logger name.
void getName (std::string &name) const
 Put name of this logger into name in current encoding.
void getName (std::wstring &name) const
 Put name of this logger into name.
void getName (CFStringRef &name) const
 Put name of this logger into name.
LoggerPtr getParent () const
 The parent of this logger.
LevelPtr getLevel () const
 The assigned Level, if any, for this logger.
helpers::ResourceBundlePtr getResourceBundle () const
 Return the inherited ResourceBundle for this logger.
void info (const std::string &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg to attached appender(s) if this logger is enabled for INFO events.
void info (const std::wstring &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg to attached appender(s) if this logger is enabled for INFO events.
void info (const CFStringRef &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg to attached appender(s) if this logger is enabled for INFO events.
bool isAttached (const AppenderPtr &appender) const override
 Is appender attached to this logger?
bool isDebugEnabled () const
 Is this logger is enabled for DEBUG level logging events?
bool isEnabledFor (const LevelPtr &level) const
 Is this logger is enabled for logging events at level?
bool isInfoEnabled () const
 Is this logger is enabled for INFO level logging events?
bool isWarnEnabled () const
 Is this logger is enabled for WARN level logging events?
bool isErrorEnabled () const
 Is this logger is enabled for ERROR level logging events?
bool isFatalEnabled () const
 Is this logger is enabled for FATAL level logging events?
bool isTraceEnabled () const
 Is this logger is enabled for TRACE level logging events?
void l7dlog (const LevelPtr &level, const LogString &key, const log4cxx::spi::LocationInfo &locationInfo, const std::vector< LogString > &values) const
void l7dlog (const LevelPtr &level, const std::string &key, const spi::LocationInfo &locationInfo=spi::LocationInfo::getLocationUnavailable(), const std::string &val1={}, const std::string &val2={}, const std::string &val3={}) const
 Add a new logging event containing locationInfo and the localized message key using parameters val1, val2 and val3 to attached appender(s) if this logger is enabled for level events.
void l7dlog (const LevelPtr &level, const std::wstring &key, const spi::LocationInfo &locationInfo=spi::LocationInfo::getLocationUnavailable(), const std::wstring &val1={}, const std::wstring &val2={}, const std::wstring &val3={}) const
 Add a new logging event containing locationInfo and the localized message key using parameters val1, val2 and val3 to attached appender(s) if this logger is enabled for level events.
void l7dlog (const LevelPtr &level, const CFStringRef &key, const spi::LocationInfo &locationInfo=spi::LocationInfo::getLocationUnavailable(), const CFStringRef &val1={}, const CFStringRef &val2={}, const CFStringRef &val3={}) const
 Add a new logging event containing locationInfo and the localized message key using parameters val1, val2 and val3 to attached appender(s) if this logger is enabled for level events.
void log (const LevelPtr &level, const std::string &message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing message and location to the appenders attached to this logger if this logger is enabled for level events.
void log (const LevelPtr &level, const std::wstring &message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing message and location to the appenders attached to this logger if this logger is enabled for level events.
void log (const LevelPtr &level, const CFStringRef &message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing message and location to the appenders attached to this logger if this logger is enabled for level events.
void logLS (const LevelPtr &level, const LogString &message, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing message and location to the appenders attached to this logger if this logger is enabled for level events.
void removeAllAppenders () override
 Remove all previously added appenders from this logger instance.
bool removeAppender (const AppenderPtr &appender) override
 Remove appender from the list of appenders.
bool removeAppender (const LogString &name) override
 Remove the name appender from the list of appenders.
bool replaceAppender (const AppenderPtr &oldAppender, const AppenderPtr &newAppender) override
 Replace oldAppender with newAppender.
void replaceAppenders (const AppenderList &newList) override
 Replace all previously added appenders with newList.
void setAdditivity (bool additive)
 Set the additivity flag for this logger.
void changeParentTo (const LoggerPtr &otherLogger)
bool isThresholdEqualTo (const LevelPtr &level) const
 Is m_threshold the same as level->toInt().
bool isThresholdEqualTo (const LoggerPtr &other) const
 Is m_threshold the same as other.
bool isThresholdValid () const
 Is m_threshold the same as getEffectiveLevel()->toInt().
void setResourceBundle (const helpers::ResourceBundlePtr &bundle)
 Set the resource bundle to be used with localized logging methods.
void warn (const std::wstring &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN events.
void warn (const CFStringRef &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN events.
void warn (const std::string &msg, const log4cxx::spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg to attached appender(s) if this logger is enabled for WARN events.
void trace (const std::wstring &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE events.
void trace (const CFStringRef &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE events.
void trace (const std::string &msg, const spi::LocationInfo &location=spi::LocationInfo::getLocationUnavailable()) const
 Add a new logging event containing msg to attached appender(s) if this logger is enabled for TRACE events.
void reconfigure (const AppenderList &newList, bool newAdditivity)
 Replace all current appenders with newList and set the additivity flag to newAdditivity.
Public Member Functions inherited from log4cxx::spi::AppenderAttachable
virtual ~AppenderAttachable ()
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

Additional Inherited Members

Static Public Member Functions inherited from log4cxx::Logger
static spi::LoggerRepositoryPtr getLoggerRepository ()
 The object that holds all Logger instances.
static LoggerPtr getLogger (const std::string &name)
 Retrieve a logger by name in current encoding.
static LoggerPtr getLogger (const std::wstring &name)
 Retrieve a logger by name.
static LoggerPtr getLogger (const CFStringRef &name)
 Retrieve a logger by name.
static LoggerPtr getRootLogger ()
 Retrieve the root logger.
static LoggerPtr getLoggerLS (const LogString &name, const spi::LoggerFactoryPtr &factory={})
 Like getLogger except that the type of logger instantiated depends on the type returned by the LoggerFactory#makeNewLoggerInstance method of the factory parameter.
static bool isDebugEnabledFor (const LoggerPtr &logger)
 Is logger is enabled for DEBUG level logging events?
static bool isInfoEnabledFor (const LoggerPtr &logger)
 Is logger is enabled for INFO level logging events?
static bool isWarnEnabledFor (const LoggerPtr &logger)
 Is logger is enabled for WARN level logging events?
static bool isErrorEnabledFor (const LoggerPtr &logger)
 Is logger is enabled for ERROR level logging events?
static bool isFatalEnabledFor (const LoggerPtr &logger)
 Is logger is enabled for FATAL level logging events?
static bool isTraceEnabledFor (const LoggerPtr &logger)
 Is logger is enabled for TRACE level logging events?
Protected Member Functions inherited from log4cxx::Logger
LogString getResourceBundleString (const LogString &key) const
 Returns the string resource corresponding to key in this logger's inherited resource bundle.
void removeHierarchy ()
 Only the Hierarchy class can remove the hierarchy of a logger.
void setHierarchy (spi::LoggerRepository *repository)
 Only the Hierarchy class can set the hierarchy of a logger.
void setParent (const LoggerPtr &parentLogger)
 Only the Hierarchy class can set the parent of a logger.
void updateCachedConfiguration ()
 Recalculate the effective configuration.

Detailed Description

RootLogger sits at the top of the logger hierachy.

It is a regular logger except that it provides several guarantees.

First, it cannot be assigned a null level. Second, since root logger cannot have a parent, the getEffectiveLevel method always returns the value of the level field without walking the hierarchy.

Constructor & Destructor Documentation

◆ RootLogger()

log4cxx::spi::RootLogger::RootLogger ( const LevelPtr & level)

The root logger names itself as "root".

However, the root logger cannot be retrieved by name.

◆ ~RootLogger()

log4cxx::spi::RootLogger::~RootLogger ( )
inline

Member Function Documentation

◆ getEffectiveLevel()

virtual LevelPtr log4cxx::spi::RootLogger::getEffectiveLevel ( ) const
virtual

Return the assigned level value without walking the logger hierarchy.

Reimplemented from log4cxx::Logger.

◆ setLevel()

void log4cxx::spi::RootLogger::setLevel ( const LevelPtr & level)
virtual

Setting a null value to the level of the root logger may have catastrophic results.

We prevent this here.

Reimplemented from log4cxx::Logger.


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