Public Member Functions |
void | assertion (bool assertionVal, const log4cplus::tstring &msg) const |
| If assertionVal parameter is false , then logs msg with FATAL_LOG_LEVEL log level.
|
void | closeNestedAppenders () const |
| 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, const char *function=NULL) const |
| 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, const char *function=NULL) const |
| This method creates a new logging event and logs the event without further checks.
|
void | callAppenders (const spi::InternalLoggingEvent &event) const |
| 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 ll) |
| 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) |
virtual SharedAppenderPtrList | getAllAppenders () |
virtual SharedAppenderPtr | getAppender (const log4cplus::tstring &name) |
virtual void | removeAllAppenders () |
virtual void | removeAppender (SharedAppenderPtr appender) |
virtual void | removeAppender (const log4cplus::tstring &name) |
| Logger (const Logger &rhs) |
Logger & | operator= (const Logger &rhs) |
void | swap (Logger &) |
Logger | getParent () const |
| Used to retrieve the parent of this Logger in the Logger tree.
|
This is the central class in the log4cplus package.
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 68 of file logger.h.
LogLevel log4cplus::Logger::getChainedLogLevel |
( |
| ) |
const |
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.
Reimplemented in OFLogger.
Retrieve a logger with name 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.
- Parameters:
-
name | The name of the logger to retrieve. |
static void log4cplus::Logger::shutdown |
( |
| ) |
|
|
static |
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 shutdown
method is careful to close nested appenders before closing regular appenders. This is allows configurations where a regular appender is attached to a logger and again to a nested appender.