log4cplus user manual Note

log4cplus user manual

log4cplus is a C++ logging library inspired by log4j, offering thread-safe and configurable logging. It supports levels, appenders for output destinations, and layouts for formatting. Installation can be done via package managers like apt-get or by building from source. The library requires C++11 for version 2.x and C++23 for the latest 3.x series. Integration with CMake projects is facilitated by package managers like Conan. A minimal example demonstrates basic initialization, logger creation, and logging a message. BasicConfigurator provides a simple default setup for console logging. For real projects, PropertyConfigurator is recommended for configuring loggers via a properties file. Log levels range from TRACE to FATAL, with ALL and OFF as pseudo-levels for filtering. Common appenders include ConsoleAppender, FileAppender, and RollingFileAppender. CallbackAppender allows routing log events to custom C-style functions. Appenders run synchronously by default, but asynchronous operation can be enabled for performance. Clean shutdown is achieved by calling log4cplus::Logger::shutdown() at program exit.