OBSOLETE: See https://github.com/log4cplus/log4cplus/wiki instead.
Welcome to the log4cplus project!
log4cplus is a simple to use C++ logging API providing thread-safe, flexible, and arbitrarily granular control over log management and configuration. It is modelled after the Java log4j API.
This project is now in "Production" status. See project status page. (obsolete)
Please feel free to contact me if you have any questions or if you would like to help the project: wilx@users.sourceforge.net.
If you want to get help with log4cplus use or compilation or if you have any other problem with it, please use the tracker or the log4cplus-devel mailing list. For bug reporting instructions see bug reporting instructions.
If you want to contribute changes to log4cplus, please see the Development wiki page for more information.
Download from SourceForge.
See Doxygen generated log4cplus API documentation for current stable release.
See README for documentation of configure
script options and portability related notes. Release procedure is documented in docs/release.txt
.
If you are looking for sample code to show you have to use log4cplus, go to code examples.
The aim of this project is to develop log4j-like logging framework for use in (primarily) C++. One of the major design goals is to avoid huge dependencies (like Boost) in the core functionality and to use as standard C++ facilities instead.
by SourceForge Robot 2023-12-23
Throw exception on nonexistent properties file, if requested by fThrow
flag.
Generate pkgconfig
file with CMake.
Add locale support to ConsoleAppender
. (Choy Kho Yee)
Initialize thread pool for async logging on demand.
SysLogAppender
: Allow non-FQDN hostname in syslog messages.
Update Catch2 to v2.13.9.
by SourceForge Robot 2023-11-17
Add missing source files to MSVC project files.
Resolve environment variables in include directive in configuration file. (#593, Martin Engelmann)
Full Changelog :
REL_2_1_0...REL_2_1_1
by SourceForge Robot 2023-02-11
Throw exception on nonexistent properties file,
if requested by fThrow
flag.
Generate pkgconfig
file with CMake.
Add locale support to ConsoleAppender
. (Choy Kho Yee)
Initialize thread pool for async logging on demand.
SysLogAppender
: Allow non-FQDN hostname
in syslog messages.
Update Catch2 to v2.13.9.
by SourceForge Robot 2022-07-09
Add CMake alias libraries. GitHub issue #511.
Add an option to disable tests to configure
script. (Fabrice Fontaine)
Fix C++11 compatibility: C++11 does not have basic_string_view
.
Look for Android's log
library. GitHub issue #543.
Fix handling of ,aux
extension for FileAppender
. GitHub issue
#534. (Pieter du Preez)
filename
should not be empty for TimeBasedRollingFileAppender
. GitHub
issue #517. (Fox Chen)
by SourceForge Robot 2021-08-09
by Václav Haisman 2021-02-22
Fixes to internal thread pool.
Internal thread pool can now be disabled during compilation. Use --disable-thread-pool
with Autotools based build or set LOG4CPLUS_ENABLE_THREAD_POOL
to OFF
with CMake based build.
Improved SONAME handling in CMake.
Update Catch to 2.13.4 to fix compilation on MacOS X on AArch64.
by Václav Haisman 2019-12-23
Modernized CMake build.
Update iOS support to build for current hardware architectures. (Patch by Pawel Maczewski)
Fix issue with std::va_list
value reuse.
Fix parsing of include
in configuration when included file path contains =
. (Patch by Peter Pei)
Fix build issue #455. Source file callbackappender.cxx
is missing from Visual Studio project for static library.
Fix issue #415. Wrong base source file name is provided if path on Windows contains /
.
Change of default behaviour: Instantiate thread pool with only 4 threads.
by SourceForge Robot 2019-04-10
Fix Catch2 include path. GitHub issue #379.
Disable POSIX signals reception in thread before creating pool
threads. GitHub issue #385 and follow up issue #390.
Fix compilation with NVCC in CUDA mode. GitHub issue #375.
Fix compilation with Visual Studio in C++17 mode. GitHub issue #401.
Allow disabling implicit initialization through configure
script option
--disable-implicit-initialization
, or CMake build option
LOG4CPLUS_REQUIRE_EXPLICIT_INITIALIZATION
. (MaksymB)
Remove android
directory with obsolete Android support. GitHub
issue #283.
Link with libatomic
when necessary. (Fabrice Fontaine)
link
by SourceForge Robot 2019-03-24
Fix compilation on systems without O_CLOEXEC
. This affects, e.g., Solaris 10. GitHub issue #326. (Patch by Jiangrz).
Provide log4cplus::deinitialize()
to make the API symmetric (log4cplus::initialize()
already exists) and to allow de-/initialization without log4cplus::Initializer
instance. GitHub issue #340.
Deal with register
keyword being generated in SWIG based bindings. The keyword is unused and reserved in C++17. Remove use of std::unary_function
, it was removed in C++17.
Add ability to define new log levels using C API. Add reconfiguration API. (Jens Rehsack)
Add NDCMatchFilter
and MDCMatchFilter
. (Franck)
link
by SourceForge Robot 2019-03-06
by Václav Haisman 2019-03-06
by SourceForge Robot 2018-12-16
Fix compilation on systems without O_CLOEXEC
. This affects, e.g., Solaris 10. GitHub issue #326. (Patch by Jiangrz).
Provide log4cplus::deinitialize()
to make the API symmetric (log4cplus::initialize()
already exists) and to allow
de-/initialization without log4cplus::Initializer
instance. GitHub issue #340.
Deal with register
keyword being generated in SWIG based bindings. The keyword is unused and reserved in C++17. Remove use of std::unary_function
, it was removed in C++17.
Add ability to define new log levels using C API. Add reconfiguration API. (Jens Rehsack)
Add NDCMatchFilter
and MDCMatchFilter
. (Franck)
link
by Václav Haisman 2018-08-21
Allow setting thread pool size using new function setThreadPoolSize()
. Allow setting the size from log4cplus.properties
using log4cplus.threadPoolSize
property. Lower initial thread pool size by half to std::thread::hardware_concurrency()
threads. GitHub issue #315.
Fix Autotools based build for MinGW. GitHub issue #317.
Add configure
script option --enable-lto
to allow easier LTO builds.
Optimization of getFormattedTime()
. (Alexey Vishtak)
Introduction of LOG4CPLUS_MACRO_FILE()
used in logging macros to allow users to redefine it and consequently hide source file names from their compiled executables and logging output.
by Václav Haisman 2018-08-21
Update to Automake 1.16.1.
Adjust spi::LoggerFactory
to allow custom spi::LoggerImpl
. GitHub
issue #309.
Fix MacOS X compilation. GitHub issue #312.
by SourceForge Robot 2018-08-20
Allow setting thread pool size using new function
setThreadPoolSize()
. Allow setting the size from log4cplus.properties
using log4cplus.threadPoolSize
property. Lower initial thread pool size
by half to std::thread::hardware_concurrency()
threads. GitHub issue
#315.
Fix Autotools based build for MinGW. GitHub issue #317.
Add configure
script option --enable-lto
to allow easier LTO builds.
Optimization of getFormattedTime()
. (Alexey Vishtak)
Introduction of LOG4CPLUS_MACRO_FILE()
used in logging macros to allow
users to redefine it and consequently hide source file names from their
compiled executables and logging output.
link
by SourceForge Robot 2018-05-27
by Václav Haisman 2018-04-16
CMake improvements: Automate export of includes if building as Cmake sub-module. (Rodion Malinovsky)
Debian spec file improvements: Use parallel build. Fix installation path on 64bit. (Michal Marek)
CMake improvements: Use ${CMAKE_INSTALL_LIBDIR}
instead of hardcoding lib. (Radek Dostál)
Experimental Windows 10 ARM support through CMAKE
by SourceForge Robot 2018-04-13
Fixed SF#322. -- C++11 construct that should not be present.
Fixed FreeAddrInfoA
and FreeAddrInfoW
not found. -- This required bump to
minimal version to Windows XP SP2.
Fixed missing thread's alternative name. -- GitHub bug #137.
Fixed GitHub bug #155. -- Process shutdown issues.
Fix GitHub bug #136. -- Adjust weekly, daily and twice daily rollover time
for DailyRollingFileAppender
by time zone offset so that the rollover
happens at midnight, etc., of local time instead of UTC time.
Fix CMake/Visual Studio 2010 compilation. -- GitHub issue #188.
link
by SourceForge Robot 2018-04-13
Fixed GitHub issue #195. Check if queue thread pointer is not NULL and if
it is running before trying to join it.
Fixed GitHub issue #205. Fixed NULL pointer dereference of queue in
AsyncAppender
code.
Fixed SF#333. AsyncAppender
's appenders need to be closed so that
accumulated logs get flushed onto disk.
Updated android.toolchain.cmake
from OpenCV.
Fixed GitHub issue #215. Mark ~HierarchyLocker()
with noexcept(false)
to avoid unlikely but possible terminate()
call and a warning message
during compilation.
Disabled TLS support for iOS.
Do not use language level thread-local storage on Cygwin. (GCC PR64697).
Allow filters cofiguration in AsyncAppender
. (suggested in SF#297 by
Markus von Arx)
Handle SocketBuffer
overflow by throwing exception.
link
by SourceForge Robot 2018-04-13
GitHub issue #205. Fixed AsyncAppender
shutdown crash.
Fix GitHub bug #195. Check if queue thread pointer is not NULL and if it
is running before trying to join it.
Fixed GitHub bug #136. Adjust weekly, daily and twice daily rollover time
for DailyRollingFileAppender
by time zone offset so that the rollover
happens at midnight, etc., of local time instead of UTC time.
Fixed GitHub bug #148. TTCCLayout
boolean members could be left
uninitialized. Initialize them.
Fixed GitHub bug #163. Fixed Visual Studio 2015 build with
CMake. Compilation fails not finding FreeAddrInfoW()
.
Disabled use of __thread
on iOS.
Fixed SF#333. AsyncAppender
's appenders need to be closed so that
accumulated logs get flushed onto disk.
Updated android.toolchain.cmake
from OpenCV project.
link
News: 2013/09/log4cplus-web-pages-have-moved
Wiki: BugReportingInstructions
Wiki: CodeExamples
Wiki: Development
Wiki: ProjectStatus
Wiki: README-1.2.0
Wiki: Release