#include <logger.h>
Inheritance diagram for log4cplus::Logger:
Public Member Functions | |
void | assertion (bool assertionVal, const log4cplus::tstring &msg) |
If assertion parameter is false , then logs msg as an error statement. | |
void | closeNestedAppenders () |
Close all attached appenders implementing the AppenderAttachable interface. | |
bool | isEnabledFor (LogLevel ll) const |
Check whether this logger is enabled for a given LogLevel passed as parameter. | |
void | log (LogLevel ll, const log4cplus::tstring &message, const char *file=NULL, int line=-1) |
This generic form is intended to be used by wrappers. | |
void | forcedLog (LogLevel ll, const log4cplus::tstring &message, const char *file=NULL, int line=-1) |
This method creates a new logging event and logs the event without further checks. | |
void | callAppenders (const spi::InternalLoggingEvent &event) |
Call the appenders in the hierrachy starting at this . | |
LogLevel | getChainedLogLevel () const |
Starting from this logger, search the logger hierarchy for a "set" LogLevel and return it. | |
LogLevel | getLogLevel () const |
Returns the assigned LogLevel, if any, for this Logger. | |
void | setLogLevel (LogLevel) |
Set the LogLevel of this Logger. | |
Hierarchy & | getHierarchy () const |
Return the the Hierarchy where this Logger instance is attached. | |
log4cplus::tstring | getName () const |
Return the logger name. | |
bool | getAdditivity () const |
Get the additivity flag for this Logger instance. | |
void | setAdditivity (bool additive) |
Set the additivity flag for this Logger instance. | |
virtual void | addAppender (SharedAppenderPtr newAppender) |
Add an appender. | |
virtual SharedAppenderPtrList | getAllAppenders () |
Get all previously added appenders as an Enumeration. | |
virtual SharedAppenderPtr | getAppender (const log4cplus::tstring &name) |
Get an appender by name. | |
virtual void | removeAllAppenders () |
Remove all previously added appenders. | |
virtual void | removeAppender (SharedAppenderPtr appender) |
Remove the appender passed as parameter from the list of appenders. | |
virtual void | removeAppender (const log4cplus::tstring &name) |
Remove the appender with the name passed as parameter from the list of appenders. | |
Logger (const Logger &rhs) | |
Logger & | operator= (const Logger &rhs) |
~Logger () | |
Logger | getParent () |
Used to retrieve the parent of this Logger in the Logger tree. | |
Static Public Member Functions | |
bool | exists (const log4cplus::tstring &name) |
Returns true if the named logger exists (in the default hierarchy). | |
LoggerList | getCurrentLoggers () |
Hierarchy & | getDefaultHierarchy () |
Return the default Hierarchy instance. | |
Logger | getInstance (const log4cplus::tstring &name) |
Retrieve a logger with name name . | |
Logger | getInstance (const log4cplus::tstring &name, spi::LoggerFactory &factory) |
Like getInstance(log4cplus::tstring) except that the type of logger instantiated depends on the type returned by the spi::LoggerFactory#makeNewLoggerInstance method of the factory parameter. | |
Logger | getRoot () |
Return the root of the default logger hierrachy. | |
void | shutdown () |
Calling this method will safely close and remove all appenders in all the loggers including root contained in the default hierachy. | |
Protected Attributes | |
spi::LoggerImpl * | value |
This is a pointer to the implementation class. | |
Friends | |
class | log4cplus::spi::LoggerImpl |
class | log4cplus::Hierarchy |
class | log4cplus::HierarchyLocker |
class | log4cplus::DefaultLoggerFactory |
One of the distintive features of log4cplus are hierarchical loggers and their evaluation.
See the user manual for an introduction on this class.
Definition at line 57 of file logger.h.
|
|
|
|
|
Add an appender.
Implements log4cplus::spi::AppenderAttachable. |
|
If
Definition at line 147 of file logger.h. References log4cplus::FATAL_LOG_LEVEL. |
|
Call the appenders in the hierrachy starting at If no appenders could be found, emit a warning. This method calls all the appenders inherited from the hierarchy circumventing any evaluation of whether to log or not to log the particular log request.
|
|
Close all attached appenders implementing the AppenderAttachable interface.
|
|
Returns
|
|
This method creates a new logging event and logs the event without further checks.
|
|
Get the additivity flag for this Logger instance.
|
|
Get all previously added appenders as an Enumeration.
Implements log4cplus::spi::AppenderAttachable. |
|
Get an appender by name.
Implements log4cplus::spi::AppenderAttachable. |
|
Starting from this logger, search the logger hierarchy for a "set" LogLevel and return it. Otherwise, return the LogLevel of the root logger. The Logger class is designed so that this method executes as quickly as possible. |
|
|
|
Return the default Hierarchy instance.
|
|
Return the the Hierarchy where this
|
|
Like getInstance(log4cplus::tstring) except that the type of logger instantiated depends on the type returned by the spi::LoggerFactory#makeNewLoggerInstance method of the This method is intended to be used by sub-classes.
|
|
Retrieve a logger with name If the named logger already exists, then the existing instance will be returned. Otherwise, a new instance is created. By default, loggers do not have a set LogLevel but inherit it from the hierarchy. This is one of the central features of log4cplus.
|
|
Returns the assigned LogLevel, if any, for this Logger.
|
|
Return the logger name.
|
|
Used to retrieve the parent of this Logger in the Logger tree.
|
|
Return the root of the default logger hierrachy. The root logger is always instantiated and available. It's name is "root". Nevertheless, calling Logger.getInstance("root") does not retrieve the root logger but a logger just under root named "root". |
|
Check whether this logger is enabled for a given LogLevel passed as parameter.
|
|
This generic form is intended to be used by wrappers.
|
|
|
|
Remove all previously added appenders.
Implements log4cplus::spi::AppenderAttachable. |
|
Remove the appender with the name passed as parameter from the list of appenders.
Implements log4cplus::spi::AppenderAttachable. |
|
Remove the appender passed as parameter from the list of appenders.
Implements log4cplus::spi::AppenderAttachable. |
|
Set the additivity flag for this Logger instance.
|
|
Set the LogLevel of this Logger.
|
|
Calling this method will safely close and remove all appenders in all the loggers including root contained in the default hierachy. Some appenders such as SocketAppender need to be closed before the application exits. Otherwise, pending logging events might be lost.
The |
|
|
|
|
|
|
|
|
|
This is a pointer to the implementation class.
|