Apache Log4cxx Version 1.1.0
Loading...
Searching...
No Matches
Logging macros

Macros

#define LOG4CXX_UNLIKELY(expr)   expr
 Provides optimization hint to the compiler to optimize for the expression being false.
 
#define LOG4CXX_STACKTRACE
 
#define LOG4CXX_LOG(logger, level, message)
 Add a new logging event containing message to attached appender(s) if this logger is enabled for events.
 
#define LOG4CXX_LOG_FMT(logger, level, ...)
 Add a new logging event containing libfmt formatted ... to attached appender(s) if this logger is enabled for events.
 
#define LOG4CXX_LOGLS(logger, level, message)
 Add a new logging event containing message to attached appender(s) if this logger is enabled for events.
 
#define LOG4CXX_DEBUG(logger, message)
 Add a new logging event containing message to attached appender(s) if logger is enabled for DEBUG events.
 
#define LOG4CXX_DEBUG_FMT(logger, ...)
 Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for DEBUG events.
 
#define LOG4CXX_TRACE(logger, message)
 Add a new logging event containing message to attached appender(s) if logger is enabled for TRACE events.
 
#define LOG4CXX_TRACE_FMT(logger, ...)
 Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for TRACE events.
 
#define LOG4CXX_INFO(logger, message)
 Add a new logging event containing message to attached appender(s) if logger is enabled for INFO events.
 
#define LOG4CXX_INFO_FMT(logger, ...)
 Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for INFO events.
 
#define LOG4CXX_WARN(logger, message)
 Add a new logging event containing message to attached appender(s) if logger is enabled for WARN events.
 
#define LOG4CXX_WARN_FMT(logger, ...)
 Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for WARN events.
 
#define LOG4CXX_ERROR(logger, message)
 Add a new logging event containing message to attached appender(s) if logger is enabled for ERROR events.
 
#define LOG4CXX_ERROR_FMT(logger, ...)
 Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for ERROR events.
 
#define LOG4CXX_ASSERT(logger, condition, message)
 If condition is not true, add a new logging event containing message to attached appender(s) if logger is enabled for ERROR events.
 
#define LOG4CXX_ASSERT_FMT(logger, condition, ...)
 If condition is not true, add a new logging event containing libfmt formatted message to attached appender(s) if logger is enabled for ERROR events.
 
#define LOG4CXX_FATAL(logger, message)
 Add a new logging event containing message to attached appender(s) if logger is enabled for FATAL events.
 
#define LOG4CXX_FATAL_FMT(logger, ...)
 Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for FATAL events.
 
#define LOG4CXX_L7DLOG(logger, level, key)
 Add a new logging event containing the localized message key to attached appender(s) if logger is enabled for level events.
 
#define LOG4CXX_L7DLOG1(logger, level, key, p1)
 Add a new logging event containing the localized message key to attached appender(s) if logger is enabled for level events with one parameter.
 
#define LOG4CXX_L7DLOG2(logger, level, key, p1, p2)
 Add a new logging event containing the localized message key to attached appender(s) if logger is enabled for level events with two parameters.
 
#define LOG4CXX_L7DLOG3(logger, level, key, p1, p2, p3)
 Add a new logging event containing the localized message key to attached appender(s) if logger is enabled for level events with three parameters.
 

Detailed Description

Macro Definition Documentation

◆ LOG4CXX_ASSERT

#define LOG4CXX_ASSERT (   logger,
  condition,
  message 
)
Value:
do { \
if (!(condition) && ::log4cxx::Logger::isErrorEnabledFor(logger)) {\
LOG4CXX_STACKTRACE \
logger->forcedLog(::log4cxx::Level::getError(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
static LevelPtr getError()
static bool isErrorEnabledFor(const LoggerPtr &logger)
Is logger is enabled for ERROR level logging events?
Definition: logger.h:1095
This class is used by the LOG4CXX_INFO and similar macros to support insertion operators in the messa...
Definition: messagebuffer.h:525
const std::string & str(CharMessageBuffer &buf)
Get content of buffer.
#define LOG4CXX_LOCATION
Definition: locationinfo.h:170

If condition is not true, add a new logging event containing message to attached appender(s) if logger is enabled for ERROR events.

Parameters
loggerthe logger to be used.
conditioncondition
messagethe message string to log.

◆ LOG4CXX_ASSERT_FMT

#define LOG4CXX_ASSERT_FMT (   logger,
  condition,
  ... 
)
Value:
do { \
if (!(condition) && ::log4cxx::Logger::isErrorEnabledFor(logger)) {\
LOG4CXX_STACKTRACE \
logger->forcedLog(::log4cxx::Level::getError(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)

If condition is not true, add a new logging event containing libfmt formatted message to attached appender(s) if logger is enabled for ERROR events.

Parameters
loggerthe logger to be used.
conditioncondition
...The format string and message to log

◆ LOG4CXX_DEBUG

#define LOG4CXX_DEBUG (   logger,
  message 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getDebug(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
static LevelPtr getDebug()
static bool isDebugEnabledFor(const LoggerPtr &logger)
Is logger is enabled for DEBUG level logging events?
Definition: logger.h:1009
#define LOG4CXX_UNLIKELY(expr)
Provides optimization hint to the compiler to optimize for the expression being false.
Definition: logger.h:1956

Add a new logging event containing message to attached appender(s) if logger is enabled for DEBUG events.

Parameters
loggerthe logger that has the enabled status.
messagea valid r-value expression of an operator<<(std::basic::ostream&. ...) overload.

Example:

LOG4CXX_DEBUG(m_log, "AddMesh:"
<< " name " << meshName
<< " type 0x" << std:: hex << traits.Type
<< " materialName " << meshObject.GetMaterialName()
<< " visible " << traits.IsDefaultVisible
<< " at " << obj->getBoundingBox().getCenter()
<< " +/- " << obj->getBoundingBox().getHalfSize()
);
#define LOG4CXX_DEBUG(logger, message)
Add a new logging event containing message to attached appender(s) if logger is enabled for DEBUG eve...
Definition: logger.h:2034
Examples
auto-configured.cpp, and trivial.cpp.

◆ LOG4CXX_DEBUG_FMT

#define LOG4CXX_DEBUG_FMT (   logger,
  ... 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getDebug(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)

Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for DEBUG events.

Parameters
loggerthe logger to be used.
...The format string and message to log

◆ LOG4CXX_ERROR

#define LOG4CXX_ERROR (   logger,
  message 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getError(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)

Add a new logging event containing message to attached appender(s) if logger is enabled for ERROR events.

Parameters
loggerthe logger to be used.
messagethe message string to log.

Example:

catch (std::exception& ex)
{
LOG4CXX_ERROR(m_log, ex.what() << " in AddScanData");
}
#define LOG4CXX_ERROR(logger, message)
Add a new logging event containing message to attached appender(s) if logger is enabled for ERROR eve...
Definition: logger.h:2170

◆ LOG4CXX_ERROR_FMT

#define LOG4CXX_ERROR_FMT (   logger,
  ... 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getError(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)

Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for ERROR events.

Parameters
loggerthe logger to be used.
...The format string and message to log

◆ LOG4CXX_FATAL

#define LOG4CXX_FATAL (   logger,
  message 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getFatal(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
static LevelPtr getFatal()
static bool isFatalEnabledFor(const LoggerPtr &logger)
Is logger is enabled for FATAL level logging events?
Definition: logger.h:1121

Add a new logging event containing message to attached appender(s) if logger is enabled for FATAL events.

Parameters
loggerthe logger to be used.
messagethe message string to log.

Example:

LOG4CXX_FATAL(m_log, m_renderSystem->getName() << " is not supported");
#define LOG4CXX_FATAL(logger, message)
Add a new logging event containing message to attached appender(s) if logger is enabled for FATAL eve...
Definition: logger.h:2229

◆ LOG4CXX_FATAL_FMT

#define LOG4CXX_FATAL_FMT (   logger,
  ... 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getFatal(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)

Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for FATAL events.

Parameters
loggerthe logger to be used.
...The format string and message to log

◆ LOG4CXX_INFO

#define LOG4CXX_INFO (   logger,
  message 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getInfo(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
static LevelPtr getInfo()
static bool isInfoEnabledFor(const LoggerPtr &logger)
Is logger is enabled for INFO level logging events?
Definition: logger.h:1043

Add a new logging event containing message to attached appender(s) if logger is enabled for INFO events.

Parameters
loggerthe logger that has the enabled status.
messagea valid r-value expression of an operator<<(std::basic::ostream&. ...) overload.

Example:

LOG4CXX_INFO(m_log, surface->GetName()
<< " successfully planned " << std::fixed << std::setprecision(1) << ((plannedArea / (plannedArea + unplannedArea)) * 100.0) << "%"
<< " planned area " << std::fixed << std::setprecision(4) << plannedArea << "m^2"
<< " unplanned area " << unplannedArea << "m^2"
<< " planned segments " << surface->GetSegmentPlanCount() << " of " << surface->GetSegmentCount()
);
#define LOG4CXX_INFO(logger, message)
Add a new logging event containing message to attached appender(s) if logger is enabled for INFO even...
Definition: logger.h:2102
Examples
auto-configured.cpp, custom-appender.cpp, format-string.cpp, and trivial.cpp.

◆ LOG4CXX_INFO_FMT

#define LOG4CXX_INFO_FMT (   logger,
  ... 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getInfo(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)

Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for INFO events.

Parameters
loggerthe logger to be used.
...The format string and message to log
Examples
format-string.cpp.

◆ LOG4CXX_L7DLOG

#define LOG4CXX_L7DLOG (   logger,
  level,
  key 
)
Value:
do { \
if (logger->isEnabledFor(level)) {\
logger->l7dlog(level, key, LOG4CXX_LOCATION); }} while (0)

Add a new logging event containing the localized message key to attached appender(s) if logger is enabled for level events.

Parameters
loggerthe logger to be used.
levelthe level to log.
keythe key to be searched in the resourceBundle of the logger.

◆ LOG4CXX_L7DLOG1

#define LOG4CXX_L7DLOG1 (   logger,
  level,
  key,
  p1 
)
Value:
do { \
if (logger->isEnabledFor(level)) {\
logger->l7dlog(level, key, LOG4CXX_LOCATION, p1); }} while (0)

Add a new logging event containing the localized message key to attached appender(s) if logger is enabled for level events with one parameter.

Parameters
loggerthe logger to be used.
levelthe level to log.
keythe key to be searched in the resourceBundle of the logger.
p1the unique parameter.

◆ LOG4CXX_L7DLOG2

#define LOG4CXX_L7DLOG2 (   logger,
  level,
  key,
  p1,
  p2 
)
Value:
do { \
if (logger->isEnabledFor(level)) {\
logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2); }} while (0)

Add a new logging event containing the localized message key to attached appender(s) if logger is enabled for level events with two parameters.

Parameters
loggerthe logger to be used.
levelthe level to log.
keythe key to be searched in the resourceBundle of the logger.
p1the first parameter.
p2the second parameter.

◆ LOG4CXX_L7DLOG3

#define LOG4CXX_L7DLOG3 (   logger,
  level,
  key,
  p1,
  p2,
  p3 
)
Value:
do { \
if (logger->isEnabledFor(level)) {\
logger->l7dlog(level, key, LOG4CXX_LOCATION, p1, p2, p3); }} while (0)

Add a new logging event containing the localized message key to attached appender(s) if logger is enabled for level events with three parameters.

Parameters
loggerthe logger to be used.
levelthe level to log.
keythe key to be searched in the resourceBundle of the logger.
p1the first parameter.
p2the second parameter.
p3the third parameter.

◆ LOG4CXX_LOG

#define LOG4CXX_LOG (   logger,
  level,
  message 
)
Value:
do { \
if (logger->isEnabledFor(level)) {\
logger->forcedLog(level, oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)

Add a new logging event containing message to attached appender(s) if this logger is enabled for events.

Parameters
loggerthe logger to be used.
levelthe level to log.
messagethe message string to log.

◆ LOG4CXX_LOG_FMT

#define LOG4CXX_LOG_FMT (   logger,
  level,
  ... 
)
Value:
do { \
if (logger->isEnabledFor(level)) {\
logger->forcedLog(level, fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)

Add a new logging event containing libfmt formatted ... to attached appender(s) if this logger is enabled for events.

Parameters
loggerthe logger to be used.
levelthe level to log.
...The format string and message to log

◆ LOG4CXX_LOGLS

#define LOG4CXX_LOGLS (   logger,
  level,
  message 
)
Value:
do { \
if (logger->isEnabledFor(level)) {\
::log4cxx::helpers::LogCharMessageBuffer oss_; \
logger->forcedLog(level, oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)

Add a new logging event containing message to attached appender(s) if this logger is enabled for events.

Parameters
loggerthe logger to be used.
levelthe level to log.
messagethe message string to log in the internal encoding.

◆ LOG4CXX_STACKTRACE

#define LOG4CXX_STACKTRACE

◆ LOG4CXX_TRACE

#define LOG4CXX_TRACE (   logger,
  message 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getTrace(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
static LevelPtr getTrace()
static bool isTraceEnabledFor(const LoggerPtr &logger)
Is logger is enabled for TRACE level logging events?
Definition: logger.h:1147

Add a new logging event containing message to attached appender(s) if logger is enabled for TRACE events.

Parameters
loggerthe logger that has the enabled status.
messagea valid r-value expression of an operator<<(std::basic::ostream&. ...) overload.

Example:

LOG4CXX_TRACE(m_log, "AddVertex:" << " p " << p[j] << " n " << n << ' ' << color);
#define LOG4CXX_TRACE(logger, message)
Add a new logging event containing message to attached appender(s) if logger is enabled for TRACE eve...
Definition: logger.h:2066

◆ LOG4CXX_TRACE_FMT

#define LOG4CXX_TRACE_FMT (   logger,
  ... 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getTrace(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)

Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for TRACE events.

Parameters
loggerthe logger to be used.
...The format string and message to log

◆ LOG4CXX_UNLIKELY

#define LOG4CXX_UNLIKELY (   expr)    expr

Provides optimization hint to the compiler to optimize for the expression being false.

Parameters
exprboolean expression.
Returns
value of expression.

◆ LOG4CXX_WARN

#define LOG4CXX_WARN (   logger,
  message 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getWarn(), oss_.str(oss_ << message), LOG4CXX_LOCATION); }} while (0)
static LevelPtr getWarn()
static bool isWarnEnabledFor(const LoggerPtr &logger)
Is logger is enabled for WARN level logging events?
Definition: logger.h:1069

Add a new logging event containing message to attached appender(s) if logger is enabled for WARN events.

Parameters
loggerthe logger to be used.
messagethe message string to log.

Example:

catch (const std::exception& ex)
{
LOG4CXX_WARN(m_log, ex.what() << ": in " << m_task->GetParamFilePath());
}
#define LOG4CXX_WARN(logger, message)
Add a new logging event containing message to attached appender(s) if logger is enabled for WARN even...
Definition: logger.h:2136
Examples
trivial.cpp.

◆ LOG4CXX_WARN_FMT

#define LOG4CXX_WARN_FMT (   logger,
  ... 
)
Value:
do { \
logger->forcedLog(::log4cxx::Level::getWarn(), fmt::format( __VA_ARGS__ ), LOG4CXX_LOCATION); }} while (0)

Add a new logging event containing libfmt formatted ... to attached appender(s) if logger is enabled for WARN events.

Parameters
loggerthe logger to be used.
...The format string and message to log