File Log.h

LSST DM logging module built on log4cxx.

Author

Bill Chickering Contact: chickering@cs.stanford.edu

Defines

LOG_CONFIG(filename)

Configures log4cxx and initializes logging module.

Parameters
  • filename: Path to configuration file.

LOG_CONFIG_PROP(string)

Configures log4cxx from a string containing list of properties. This is equivalent to configuring with a file name containing the same data as a string.

Note

Use of this macro will likely produce hard-coded configuration which is not advised for general-use code. It may be useful where pre-defined hard-coded configuration is necessary, e.g. in unit tests.

Parameters
  • string: List of properties (lines separated by new line character)

LOG_GET(logger)

Returns a Log object associated with logger.

Return

Log object corresponding to logger.

Parameters
  • logger: Either a logger name or a Log object.

LOG_GET_CHILD(logger, suffix)

Returns a Log object associated with descendant of a logger.

Return

Log object corresponding to logger’s descendant.

Parameters
  • logger: Either a logger name or a Log object.

  • suffix: Suffix of a descendant.

LOG_MDC(key, value)

Places a KEY/VALUE pair in the Mapped Diagnostic Context (MDC) for the current thread. The VALUE may then be included in log messages by using the following the X conversion character within a pattern layout as X{KEY}.

Parameters
  • key: Unique key.

  • value: String value.

LOG_MDC_REMOVE(key)

Remove the value associated with KEY within the MDC.

Parameters
  • key: Key identifying value to remove.

LOG_CONCAT_IMPL(a, b)
LOG_CONCAT_IMPL2(a, b)
LOG_MDC_SCOPE(key, value)

Places a KEY/VALUE pair in the Mapped Diagnostic Context (MDC) for the current thread, and restores previous KEY/VALUE on exit from a scope.

Parameters
  • key: Unique key.

  • value: String value.

LOG_MDC_INIT(func)

Register function for initialization of MDC. This function will be called for current thread and every new thread (but not for other existing threads) before any message is logged using one of the macros below. Its main purpose is to initialize MDC (using LOG_MDC macro). In some cases the function may be called more than once per thread.

This macro is thread safe, but typically it will be called from main thread before any other LOG macro.

Macro returns an integer number, the value is not specified, but this allows it to be used in one-time initialization constructs like:

static int dummyMdcInit = LOG_MDC_INIT(some_init_func);

Parameters
  • func: Any function object which takes no arguments and returns void.

LOG_SET_LVL(logger, level)

Set the logging threshold for LOGGER to LEVEL.

Parameters
  • logger: Logger with threshold to adjust.

  • level: New logging threshold.

LOG_GET_LVL(logger)

Retrieve the logging threshold for LOGGER.

Return

int Indicating the logging threshold.

Parameters
  • logger: Either a logger name or a Log object with threshold to return.

LOG_CHECK_LVL(logger, level)

Return whether the logging threshold of LOGGER is less than or equal to LEVEL.

Return

Bool indicating whether or not logger is enabled.

Parameters
  • logger: Either a logger name or a Log object being queried.

  • level: Logging threshold to check.

LOG_CHECK_TRACE()

Return whether the logging threshold of the default logger is less than or equal to TRACE.

Return

Bool indicating whether or not logger is enabled.

LOG_CHECK_DEBUG()

Return whether the logging threshold of the default logger is less than or equal to DEBUG.

Return

Bool indicating whether or not logger is enabled.

LOG_CHECK_INFO()

Return whether the logging threshold of the default logger is less than or equal to INFO.

Return

Bool indicating whether or not logger is enabled.

LOG_CHECK_WARN()

Return whether the logging threshold of the default logger is less than or equal to WARN.

Return

Bool indicating whether or not logger is enabled.

LOG_CHECK_ERROR()

Return whether the logging threshold of the default logger is less than or equal to ERROR.

Return

Bool indicating whether or not logger is enabled.

LOG_CHECK_FATAL()

Return whether the logging threshold of the default logger is less than or equal to FATAL.

Return

Bool indicating whether or not logger is enabled.

LOG(logger, level, message...)

Log a message using a varargs/printf style interface.

Parameters
  • logger: Either a logger name or a Log object.

  • level: Logging level associated with message.

  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOG_TRACE(message...)

Log a trace-level message to the default logger using a varargs/printf style interface.

Parameters
  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOG_DEBUG(message...)

Log a debug-level message to the default logger using a varargs/printf style interface.

Parameters
  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOG_INFO(message...)

Log a info-level message to the default logger using a varargs/printf style interface.

Parameters
  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOG_WARN(message...)

Log a warn-level message to the default logger using a varargs/printf style interface.

Parameters
  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOG_ERROR(message...)

Log a error-level message to the default logger using a varargs/printf style interface.

Parameters
  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOG_FATAL(message...)

Log a fatal-level message to the default logger using a varargs/printf style interface.

Parameters
  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOG_MESSAGE_VIA_STREAM_(logger, level, message)
LOGS(logger, level, message)

Log a message using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGS("logger", LOG_LVL_DEBUG, "coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • logger: Either a logger name or a Log object.

  • level: Logging level associated with message.

  • message: Message to be logged.

LOGS_TRACE(message)

Log a trace-level message to the default logger using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGS_TRACE("coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • message: Message to be logged.

LOGS_DEBUG(message)

Log a debug-level message to the default logger using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGS_DEBUG("coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • message: Message to be logged.

LOGS_INFO(message)

Log a info-level message to the default logger using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGS_INFO("coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • message: Message to be logged.

LOGS_WARN(message)

Log a warning-level message to the default logger using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGS_WARN("coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • message: Message to be logged.

LOGS_ERROR(message)

Log a error-level message to the default logger using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGS_ERROR("coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • message: Message to be logged.

LOGS_FATAL(message)

Log a fatal-level message to the default logger using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGS_FATAL("coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • message: Message to be logged.

LOGL_TRACE(logger, message...)

Log a trace-level message using a varargs/printf style interface.

Parameters
  • logger: Either a logger name or a Log object.

  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOGL_DEBUG(logger, message...)

Log a debug-level message using a varargs/printf style interface.

Parameters
  • logger: Either a logger name or a Log object.

  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOGL_INFO(logger, message...)

Log a info-level message using a varargs/printf style interface.

Parameters
  • logger: Either a logger name or a Log object.

  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOGL_WARN(logger, message...)

Log a warn-level message using a varargs/printf style interface.

Parameters
  • logger: Either a logger name or a Log object.

  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOGL_ERROR(logger, message...)

Log a error-level message using a varargs/printf style interface.

Parameters
  • logger: Either a logger name or a Log object.

  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOGL_FATAL(logger, message...)

Log a fatal-level message using a varargs/printf style interface.

Parameters
  • logger: Either a logger name or a Log object.

  • message: An sprintf-compatible format string followed by zero, one, or more comma-separated arguments.

LOGLS_TRACE(logger, message)

Log a trace-level message using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGLS_TRACE(logger, "coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • logger: Either a logger name or a Log object.

  • message: Message to be logged.

LOGLS_DEBUG(logger, message)

Log a debug-level message using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGLS_DEBUG(logger, "coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • logger: Either a logger name or a Log object.

  • message: Message to be logged.

LOGLS_INFO(logger, message)

Log a info-level message using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGLS_INFO(logger, "coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • logger: Either a logger name or a Log object.

  • message: Message to be logged.

LOGLS_WARN(logger, message)

Log a warn-level message using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGLS_WARN(logger, "coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • logger: Either a logger name or a Log object.

  • message: Message to be logged.

LOGLS_ERROR(logger, message)

Log a error-level message using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGLS_ERROR(logger, "coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • logger: Either a logger name or a Log object.

  • message: Message to be logged.

LOGLS_FATAL(logger, message)

Log a fatal-level message using an iostream-based interface.

Message is any expression which can appear on the right side of the stream insertion operator, e.g. LOGLS_FATAL(logger, "coordinates: x=" << x << " y=" << y);. Usual caveat regarding commas inside macro arguments applies to message argument.

Parameters
  • logger: Either a logger name or a Log object.

  • message: Message to be logged.

LOG_LVL_TRACE
LOG_LVL_DEBUG
LOG_LVL_INFO
LOG_LVL_WARN
LOG_LVL_ERROR
LOG_LVL_FATAL
LOG_LOGGER
namespace lsst

Class for a simple mapping implementing a generic AstrometryTransform.

Remove all non-astronomical counts from the Chunk Exposure’s pixels.

Forward declarations for lsst::utils::Cache

For details on the Cache class, see the Cache.h file.

It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.

A base class for image defects

Numeric constants used by the Integrate.h integrator routines.

Compute Image Statistics

Note

Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.

Note

The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.

namespace log

Functions

unsigned lwpID()

Function which returns LWP ID on platforms which support it.

On all other platforms a small incremental integer number (counting number of threads) is returned. This function can be used to produce more human-friendly thread ID for logging instead of regular t format.

class Log
#include <Log.h>

This static class includes a variety of methods for interacting with the the logging module. These methods are not meant for direct use. Rather, they are used by the LOG* macros and the SWIG interface declared in logInterface.h.

Public Functions

Log()
bool isDebugEnabled() const

Check whether the logger is enabled for the DEBUG Level

bool isErrorEnabled() const

Check whether the logger is enabled for the ERROR Level

bool isFatalEnabled() const

Check whether the logger is enabled for the FATAL Level

bool isInfoEnabled() const

Check whether the logger is enabled for the INFO Level

bool isTraceEnabled() const

Check whether the logger is enabled for the TRACE Level

bool isWarnEnabled() const

Check whether the logger is enabled for the WARN Level

std::string getName() const
void setLevel(int level)
int getLevel() const
bool isEnabledFor(int level) const
Log getChild(std::string const &suffix) const
void log(log4cxx::LevelPtr level, log4cxx::spi::LocationInfo const &location, char const *fmt, ...)
void logMsg(log4cxx::LevelPtr level, log4cxx::spi::LocationInfo const &location, std::string const &msg)

Public Static Functions

static Log getDefaultLogger()

Return default logger instance, same as default constructor.

static void configure()
static void configure(std::string const &filename)
static void configure_prop(std::string const &properties)
static Log getLogger(Log const &logger)
static Log getLogger(std::string const &loggername)
static std::string MDC(std::string const &key, std::string const &value)
static void MDCRemove(std::string const &key)
static int MDCRegisterInit(std::function<void()> function)

Private Functions

Log(log4cxx::LoggerPtr const &logger)

Construct a Log using a LOG4CXX logger.

The default constructor is called to ensure the default logger is initialized and LOG4CXX is configured.

Private Members

log4cxx::LoggerPtr _logger

Private Static Functions

static log4cxx::LoggerPtr const &_defaultLogger()

Returns default LOG4CXX logger, which is the same as root logger.

This method is needed to ensure proper LOG4CXX initialization before any code uses any logger instance.

class LogMDCScope

Public Functions

LogMDCScope(std::string const &key, std::string const &value)

Constructor adds KEY/VALUE pair to current thread MDC. Key should not be empty (not checked).

LogMDCScope(LogMDCScope const&)
LogMDCScope &operator=(LogMDCScope const&)
LogMDCScope(LogMDCScope &&other)
LogMDCScope &operator=(LogMDCScope &&other)
~LogMDCScope()

Destructor restores old key value in MDC.

Private Members

std::string _key
std::string _oldValue