log4cplus  2.1.0
Public Member Functions | List of all members
log4cplus::spi::RootLogger Class Reference

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

#include <rootlogger.h>

Inheritance diagram for log4cplus::spi::RootLogger:
[legend]
Collaboration diagram for log4cplus::spi::RootLogger:
[legend]

Public Member Functions

 RootLogger (Hierarchy &h, LogLevel ll)
 The root logger names itself as "root". More...
 
virtual LogLevel getChainedLogLevel () const
 Return the assigned LogLevel value without walking the logger hierarchy. More...
 
void setLogLevel (LogLevel)
 Setting a NOT_SET_LOG_LEVEL value to the LogLevel of the root logger may have catastrophic results. More...
 
- Public Member Functions inherited from log4cplus::spi::LoggerImpl
virtual void callAppenders (const InternalLoggingEvent &event)
 Call the appenders in the hierrachy starting at this. More...
 
virtual void closeNestedAppenders ()
 Close all attached appenders implementing the AppenderAttachable interface. More...
 
virtual bool isEnabledFor (LogLevel ll) const
 Check whether this logger is enabled for a given LogLevel passed as parameter. More...
 
virtual void log (LogLevel ll, const log4cplus::tstring &message, const char *file=nullptr, int line=-1, const char *function=nullptr)
 This generic form is intended to be used by wrappers. More...
 
virtual void log (spi::InternalLoggingEvent const &)
 
LogLevel getLogLevel () const
 Returns the assigned LogLevel, if any, for this Logger. More...
 
void setLogLevel (LogLevel _ll)
 Set the LogLevel of this Logger. More...
 
virtual HierarchygetHierarchy () const
 Return the the Hierarchy where this Logger instance is attached. More...
 
log4cplus::tstring const & getName () const
 Return the logger name. More...
 
bool getAdditivity () const
 Get the additivity flag for this Logger instance. More...
 
void setAdditivity (bool additive)
 Set the additivity flag for this Logger instance. More...
 
virtual ~LoggerImpl ()
 
- Public Member Functions inherited from log4cplus::helpers::SharedObject
void addReference () const LOG4CPLUS_NOEXCEPT
 
void removeReference () const
 
- Public Member Functions inherited from log4cplus::helpers::AppenderAttachableImpl
 AppenderAttachableImpl ()
 
virtual ~AppenderAttachableImpl ()
 
virtual void addAppender (SharedAppenderPtr newAppender)
 Add an appender. More...
 
virtual SharedAppenderPtrList getAllAppenders ()
 Get all previously added appenders as an vectory. More...
 
virtual SharedAppenderPtr getAppender (const log4cplus::tstring &name)
 Look for an attached appender named as name. More...
 
virtual void removeAllAppenders ()
 Remove all previously added appenders. More...
 
virtual void removeAppender (SharedAppenderPtr appender)
 Remove the appender passed as parameter from the list of appenders. More...
 
virtual void removeAppender (const log4cplus::tstring &name)
 Remove the appender with the name passed as parameter from the list of appenders. More...
 
int appendLoopOnAppenders (const spi::InternalLoggingEvent &event) const
 Call the doAppend method on all attached appenders. More...
 
- Public Member Functions inherited from log4cplus::spi::AppenderAttachable
virtual ~AppenderAttachable ()=0
 

Additional Inherited Members

- Public Types inherited from log4cplus::spi::LoggerImpl
typedef helpers::SharedObjectPtr< LoggerImplSharedLoggerImplPtr
 
- Public Attributes inherited from log4cplus::helpers::SharedObject
thread::Mutex access_mutex
 
- Public Attributes inherited from log4cplus::helpers::AppenderAttachableImpl
thread::Mutex appender_list_mutex
 
- Protected Types inherited from log4cplus::helpers::AppenderAttachableImpl
typedef std::vector< SharedAppenderPtrListType
 
- Protected Member Functions inherited from log4cplus::spi::LoggerImpl
 LoggerImpl (const log4cplus::tstring &name, Hierarchy &h)
 This constructor created a new Logger instance and sets its name. More...
 
virtual void forcedLog (LogLevel ll, const log4cplus::tstring &message, const char *file, int line, const char *function)
 This method creates a new logging event and logs the event without further checks. More...
 
virtual void forcedLog (spi::InternalLoggingEvent const &ev)
 
- Protected Member Functions inherited from log4cplus::helpers::SharedObject
 SharedObject ()
 
 SharedObject (const SharedObject &)
 
 SharedObject (SharedObject &&)
 
virtual ~SharedObject ()
 
SharedObjectoperator= (const SharedObject &) LOG4CPLUS_NOEXCEPT
 
SharedObjectoperator= (SharedObject &&) LOG4CPLUS_NOEXCEPT
 
- Protected Attributes inherited from log4cplus::spi::LoggerImpl
log4cplus::tstring name
 The name of this logger. More...
 
LogLevel ll
 The assigned LogLevel of this logger. More...
 
SharedLoggerImplPtr parent
 The parent of this logger. More...
 
bool additive
 Additivity is set to true by default, that is children inherit the appenders of their ancestors by default. More...
 
- Protected Attributes inherited from log4cplus::helpers::AppenderAttachableImpl
ListType appenderList
 Array of appenders. More...
 

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 NOT_SET_LOG_LEVEL LogLevel. Second, since root logger cannot have a parent, the getChainedLogLevel method always returns the value of the ll field without walking the hierarchy.

Definition at line 47 of file rootlogger.h.

Constructor & Destructor Documentation

◆ RootLogger()

log4cplus::spi::RootLogger::RootLogger ( Hierarchy h,
LogLevel  ll 
)

The root logger names itself as "root".

However, the root logger cannot be retrieved by name.

Member Function Documentation

◆ getChainedLogLevel()

virtual LogLevel log4cplus::spi::RootLogger::getChainedLogLevel ( ) const
virtual

Return the assigned LogLevel value without walking the logger hierarchy.

Reimplemented from log4cplus::spi::LoggerImpl.

◆ setLogLevel()

void log4cplus::spi::RootLogger::setLogLevel ( LogLevel  )

Setting a NOT_SET_LOG_LEVEL value to the LogLevel of the root logger may have catastrophic results.

We prevent this here.


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