Log for C++ Project


 | Log for C++ Project Page on Sourceforge  | Last Published: 2026-03-26  | Sourceforge Home  |

What is log4cpp?

Log4cpp is library of C++ classes for flexible logging to files, syslog, IDSA and other destinations. It is modeled after the Log4j Java library, staying as close to their API as is reasonable.

Download

Sources are available from SourceForges download page.
We do not supply binaries, because of the numerous incompatible ABIs (e.g. g++ 2.95 vs 2.96 vs 3.0 vs 3.2) and different package formats.

Distributions

A stable but older version of log4cpp is available in Debian stable, see http://packages.debian.org/stable/libs/.
Ubuntu enlists log4cpp among packages at https://packages.ubuntu.com/.
FreeBSD users can find log4cpp in the ports collection, see http://www.freebsd.org/ports/devel.html
Log4cpp includes support for building RPMs, so building your own from the source tar-ball is as simple as

rpm -ta log4cpp-x.y.z.tar.gz

^

Building Log4cpp

Linux/*nix, Autoconf

The project uses GNU Autotools as primary build system. CMake is secondary option.

If file ./configure is absent in project directory (as when the code is checked out from repository), run the following:

./autogen.sh
This will create ./configure and the necessary Makefile.in's. Then:
./configure
make
make check
make install

This will build and install log4cpp under /usr/local. To install in another location specify option --prefix=<location> when running configure.

Options for ./configure

Besides the usual ./configure options like --prefix a few others are available:
--with-idsa
Include support for logging to IDSA (http://jade.cs.uct.ac.za/idsa/index.html). This will give you an IdsaAppender Appender class.
--with-omnithreads[=<path-to-omniORB>]
Enable multi-threading support using omniORB4's omniThreads MT abstraction library (http://www.omniorb.org). configure expects the omnithread header files to reside in <path-to-omniORB>/include and the library in <path-to-omniORB</lib, i.e. not in a platform specific subdirectory. Create symlinks where necessary.
NB. omniORB4 is required: omniORB3 will not suffice as it lacks sufficient support for thread specific data. At the moment (August 2002) omniORB4 is in beta, however most parts and specifically the threading library appear to be quite stable.
--with-pthreads
Enable multi-threading support using the 'pthread' POSIX threads library. This option is mutually exclusive with --with-omnithreads.
--enable-doxyen
Enables generation of API documentation by Dimitri van Heeschs Doxygen tool (http://www.doxygen.org/). Defaults to yes if doxygen can be found in the search path.
--enable-html-docs
If doxygen is enabled, have it generate HTML formatted documentation.
--enable-latex-docs
If doxygen is enabled, have it generate LaTeX formatted documentation.
--enable-dot
Let Doxygen use the 'dot' tool of GraphViz (http://www.graphviz.org) to draw its graphs.
--disable-remote-syslog
Exclude RemoteSyslogAppender from build (included by default)
--disable-smtp
Exclude SmtpAppender from build (included by default)

^

Linux/*nix, CMake

Browse into the source code catalog (log4cpp) and run the following for Release build:

cmake -S . -B build_release -DCMAKE_BUILD_TYPE=Release
cmake --build build_release
This will create ./build_release, compile and build libraries into it.

Optionally, run tests (expected result is 100% tests passed):

cd build_release/tests
ctest

Debug build is analogous:

cmake -S . -B build_debug -DCMAKE_BUILD_TYPE=Debug
cmake --build build_debug

Run tests for debug build:

cd build_debug/tests
ctest

^

Windows, CMake

MS Visual Studio 2022

MS Visual Studio 2022 can open log4cpp directly as a CMake project.

  • Use File → Open → CMake... menu items to choose log4cpp/CMakeLists.txt file and start CMake generation.
  • After CMake generation is finished, choose Build → Build All to build log4cpp libs.
  • Optionally, run set of tests from Test → Run CTests

Note: Native project files intended for older MSVC versions (msvc10, msvc7, msvc6) are archived since log4cpp 1.1.6 into projects directory.

Embarcadero RAD Studio 12

Embarcadero RAD Studio 12 can build log4cpp project using its bundled version of CMake, provided via the RAD Package Manager.
Make sure that Embarcadero's CMake (and not another installation) is used for command line. Ninja generator will be used as build system, you can get ninja-win.zip at Ninja site and extract the executable into catalog included into PATH environment variable.
Open RAD Studio Command Prompt and run commands to build log4cpp libs:

Release:

cmake.exe -G Ninja -S . -B build_release -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_CROSSCOMPILING=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_ASM_COMPILER=bcc64x -DCMAKE_C_COMPILER=bcc64x -DCMAKE_CXX_COMPILER=bcc64x
cmake.exe --build build_release --config Release -v

Debug:

cmake.exe -G Ninja -S . -B build_debug -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_CROSSCOMPILING=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ASM_COMPILER=bcc64x -DCMAKE_C_COMPILER=bcc64x -DCMAKE_CXX_COMPILER=bcc64x
cmake.exe --build build_debug --config Debug -v

Works since log4cpp 1.1.5.

^

Build notes for specific platforms

*nix - g++ compiler
Log4cpp should build without modification on any decent *nix system with g++ and GNU make. The primary development platform is RedHat Linux 7.3, which has g++ 2.96-rh, but the aim is to be compatible with from g++ 2.95 and up. When g++ 3.x has been widely adopted we may drop support for older g++ versions.
Solaris - Sun CC compiler
Compilation with Suns CC compiler requires setting some enviroment variables. Also static libraries appear not to work. In short do:
CC=CC CXX=CC LD="CC -KPIC" ./configure --disable-static
Win32 - VS2010
Use the workspace and project files in subdirectory msvc10. You may need to adjust include/log4cpp/config-win32.h and the project files to your particular needs. Since log4cpp 1.1.6, directory with project files is kept as archive in directory projects. Extract it into project's root to use.
Win32 - MSVC++ 6
Use the workspace and project files in subdirectory msvc6. You may need to adjust include/log4cpp/config-win32.h and the project files to your particular needs. Since log4cpp 1.1.6, directory with project files is kept as archive in directory projects. Extract it into project's root to use.
Win32 - MSVC++ 5
Building log4cpp with MSVC++ 5 is not supported and will not be, unless someone can find a way to do so without mutilating the source code.
Win32 - Borland C++ Builder 5
Use the project and make files in subdirectory bcb5. Since log4cpp 1.1.6, directory with project files is kept as archive in directory projects. Extract it into project's root to use.
Win32 - Cygwin
Use ./configure; make; make install
Be warned that there have been very few success or failure reports for this platform, so either it works very smoothly or noone actively uses log4cpp with Cygwin :-)
OpenVMS
Edit include/log4cpp/config-openvms.h if you need different settings.
This has been tested on OpenVMS Alpha v7.3 and Compaq C++ V6.3-020 only.
1) Copy the src and include directory (including all its contents and subdirectories) onto your OpenVMS system.
2) Compile each source file (*.CPP and *.C in the src directory) one by one with the following command,
cxx /include=("/a1\$dkb0/user/tony/project/log4cpp/include") /define=(__USE_STD_IOSTREAM,__OPENVMS__) /repository=a1$dkb0:[user.tony.project.log4cpp.repository] APPENDER.CPP
cxx /include=("/a1\$dkb0/user/tony/project/log4cpp/include") /define=(__USE_STD_IOSTREAM,__OPENVMS__) /repository=a1$dkb0:[user.tony.project.log4cpp.repository] APPENDERSKELETON.CPP
...etc
Please substitute a correct path for your include directory. A unix-style directory name is requied in the /include parameter. In this example, the path is A1$DKBO:[USER.TONY.PROJECT.LOG4CPP.INCLUDE]
A repository directory is also specified here as A1$DKB0:[USER.TONY.PROJECT.LOG4CPP.REPOSITORY].
3) Create a static library, LOG4CPP.OLB
lib/create log4cpp
4) Put all compiled OBJ files into the LOG4CPP.OLB
lib/insert log4cpp appender
lib/insert log4cpp appenderskeleton
...etc
5) Link a program with log4cpp.olb. e.g:
cxx /include=("/a1\$dkb0/user/tony/project/log4cpp/include") /define=(__USE_STD_IOSTREAM,__OPENVMS__) testlog4cpp.cxx
cxxlink /repository=a1$dkb0:[user.tony.project.log4cpp.repository] testlog4cpp,log4cpp/library

^

License

This library is licensed under the Lesser General Public License version 2.1 (LGPL 2.1) as of version 0.2.1, instead of the General Public License (GPL). No further license changes are planned. :-)

Log for C++ (short name: log4cpp), a C++ library for flexible logging.
Copyright (C) 2000-2002 LifeLine Networks bv
Copyright (C) 2000-2002 Bastiaan Bakker
Portions Copyright others, see file THANKS and source code.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see https://www.gnu.org/licenses/.
^

API Doxygen

API Documentation generated by Doxygen can be found at Doxygen generated API.

^

Documentation

The Solaris Developer Connection features an article by Mo Budlon on using log4cpp 0.2.x, called 'Logging and Tracing in C++ Simplified'. Recommended reading if you trying to figure out how to use log4cpp!

^

FAQ

1. GENERAL

1.1. What is Log for C++?

Log for C++ is a library of C++ classes for flexible logging to files, syslog and other destinations. It is modeled after the Log for Java library (http://jakarta.apache.org/log4j/), staying as close to their API as is reasonable.

1.2. How is Log for C++ related to Log4j? Is it a straight port?

Log for C++ strives to supply a similar interface for logging in C++ as Log4j provides in Java. However the implementation is not a translation of the Java code. So in that sense it is not a 'port' of Log4j. Of course Log for C++ does owe many of its concepts to log4j.

1.3. What is the name of this project, 'Log for C++' or 'log4cpp'?

The 'official' long name of the project is 'Log for C++', but in practice, the short name, 'log4cpp' has proven more convinient.

1.4. Under which license is Log for C++ available?

As of version 0.2.1 Log for C++ is released under the GNU Lesser General Public License (LGPL). Versions before that have been released under the GPL. See the license discussion on the forum at SourceForge for the motivations behind switching from GPL to LGPL.

1.5. Our legal department doesn't like the LGPL, can you release Log for C++ under license XYZ?

No.
Long answer: Technically it may be possible if every contributor agrees, which due to their growing number has become increasingly difficult. But even if that could be overcome it will not happen.
Of course the LGPL does grant you the opportunity to choose the GPL instead of the LGPL, but I bet XYZ != GPL.

2. COMPILATION AND INSTALLATION

See Building

3. USAGE

3.1. I've succesfully compiled log4cpp, now how do I use this stuff?

  • Have a glance at Simple example and Properties file example.
  • For additional small examples using log4cpp, see the tests subdirectory.
  • Examples on using log4cpp with CMake enabled projects are in examples/cmake_usages subdirectory.
  • Check the Doxygen generated API section for API reference and more usage information.

3.2. Is log4cpp thread-safe?

  • The same instance of a
    log4cpp::Category
    object (a logger) can be used simultaneously from multiple threads without explicit synchronization.
  • Concurrent access to appenders is handled by the logger itself. Logger (category) locks an internal mutex each time it writes to an appender.
  • Therefore, it is safe, for example, for multiple threads to write to the same logger. Log records will not interleave.
  • However, if log4cpp is configured in such a way that two different loggers append to the same appender instance (for example, the same file appender), then the framework cannot guarantee proper synchronization between loggers (categories), and log messages may become interleaved or corrupted. Configuring multiple loggers to share the same appender instance is therefore not recommended.

3.3. What are possible format characters for the custom log message?

PatternLayout supports following set of format characters:
  • %%
    - a single percent sign
  • %c
    - the category
  • %d
    - the date\n Date format: The date format character may be followed by a date format specifier enclosed between braces. For example,
    %d{%H:%M:%S,%l} or %d{%d %m %Y %H:%M:%S,%l}
    . If no date format specifier is given then the following format is used:
    "Wed Jan 02 02:03:55 1980"
    . The date format specifier admits the same syntax as the ANSI C function strftime, with 1 addition. The addition is the specifier
    %l
    for milliseconds, padded with zeros to make 3 digits.
  • %m
    - the message
  • %n
    - the platform specific line separator
  • %p
    - the priority
  • %r
    - milliseconds since this layout was created.
  • %R
    - seconds since Jan 1, 1970
  • %u
    - clock ticks since process start
  • %x
    - the NDC
  • %t
    - thread name
By default, ConversionPattern for PatternLayout is set to
"%m%n"
.

3.4. What log levels are available?

Log4cpp provides the following log levels (priorities), ordered from lowest to highest severity:

  • TRACE 
    - very fine-grained diagnostic information. Usage: Function entry/exit, loop iterations, variable changes, or high-frequency internal events during deep debugging.
  • DEBUG 
    - detailed diagnostic information. Usage: Debugging program logic, inspecting important state, or understanding code flow during development.
  • INFO  
    - general informational messages. Usage: Normal application behavior such as startup, shutdown, configuration loading, or key workflow steps.
  • NOTICE
    - normal but significant conditions. Usage: Important events that are not errors but worth highlighting (e.g., configuration changes, feature toggles).
  • WARN  
    - warning conditions. Usage: Unexpected situations that are recoverable (e.g., missing optional data, retries, deprecated API usage).
  • ERROR 
    - error conditions. Usage: Failures that affect a specific operation but do not stop the entire application (e.g., failed request, file read error).
  • CRIT  
    - critical conditions. Usage: Serious failures impacting major components (e.g., subsystem unavailable, database connection lost).
  • ALERT 
    - action must be taken immediately. Usage: Conditions requiring immediate intervention (e.g., data corruption risk, critical resource exhaustion).
  • FATAL 
    - severe errors causing program termination. Usage: Unrecoverable errors leading to shutdown (e.g., inability to initialize core components).

3.5. How can I log a line in log4cpp?

There are following ways to log a message:

  • Use logging methods
    Call a Category's method corresponding to the log level and pass parameters.
    log4cpp::Category& logger = log4cpp::Category::getRoot();
    logger.debug("Debug message");
    logger.info("Info message # %d", 2);
  • Use streaming
    Log messages with C++ streams.
    logger.debugStream() << "Render " << loginpage << " address";
    logger << log4cpp::Priority::INFO << "Server " << servername << " started up";
  • Use macros
    Use formatted or streaming style macros. Note: If the message's priority is less severe than the logger's priority, then the arguments are not evaluated, avoiding unnecessary computation.
    LOG4CPP_DEBUG(logger, "Items left in stock: %d remaining", calcRemainder());
    LOG4CPP_INFO_S(logger, "Temperature in warehouse: " << readTemperature());

3.6. How can I reduce logging overhead?

Building complex log messages can introduce runtime overhead. You can reduce this overhead in several ways:

  • Use macros with appropriate log levels. Log4cpp macros (e.g., LOG4CPP_DEBUG, LOG4CPP_INFO_S) will compare message's priority to the logger’s level before evaluating arguments, preventing unnecessary computations when a message is not logged due to its lower priority.
  • Completely remove lower-severity log messages at compile time. By defining the desired level before including the macros header, all log macros with a priority lower than LOG4CPP_ACTIVE_LEVEL are removed at compile time, resulting in zero runtime overhead. For example, to remove all logs below INFO level in current compilation unit:
    #define LOG4CPP_ACTIVE_LEVEL LOG4CPP_PRIORITY_INFO
    #include <log4cpp/LogMacros.hh>

4. PROBLEMS AND ERROR MESSAGES

4.1. I get 'Naming collision for 'ERROR' detected. Please read the FAQ for a workaround.'

This is caused by the rudeness of some platforms, which mutilate the namespace with some blunt #defines. To be more precise, the Win32 API includes #defines of 'ERROR' and 'DEBUG'. Since the preprocessor is unaware of C++ naming scopes this results in reserving the words ERROR and DEBUG litterally everywhere. In particular this conflicts with log4cpp::Prioritiy::ERROR and log4cpp::Priority::DEBUG. These latter two names come from log4j, so they are not something we made up ourselves.
They Win32 authors should not have rudelessly claimed these generic names through the preprocessor. There are much better alternatives:
  1. If they use it as an integer constant, declare it using a language construct. Either 'enum {ERROR=1};' or 'static const int ERROR=1;' would do fine.
  2. Use a less generic name like WIN32API_ERROR to make naming conflicts less likely
  3. In case they use it as a flag for conditional compilation, use '#define DEBUG DEBUG' and '#if defined(DEBUG)'. In that case the preprocessor would simply replace all occurrences of 'DEBUG' in the source code with 'DEBUG', in effect leaving everything intact.

Of course the proper solution would be if the offending party would use one of the above methods, but we could have to wait some time for this to actually happen. As an alternative log4cpp can workaround these #defines. The workaround code is enabled by doing #define LOG4CPP_FIX_ERROR_COLLISION 1 before #including any log4cpp header files and after #including all platform headers. For Win32 platforms this #define has already been included in log4cpp/config-win32.h.

Once log4cpp has been updated to the log4j 1.2 API we can get rid of this problem by adopting the new names for log levels.

4.2. I am trying to compile/link the log4cpp package using the SunWorkshop compiler (CC) on a Solaris 7 machine. The library builds, but the testmain code fails to link properly.

A proper solution for this problem has not been found yet (suggestions are welcome), but James Emery reported success with the following workaround:
  • Disable building of the static library
  • Change the linker from /usr/ucb/ld to CC and enable 'place independent code' (pic).
In short, configure with:
export LD="CC -Kpic" && ./configure --disable-static

4.3. ./configure fails to detect 'snprintf()' on platform XYZ.

./configure does not just check for the presence of a snprintf() function but for C99 compliancy as well. In particular, snprintf() should strictly honour the 'string size' parameter to avoid potential buffer overflow problems. log4cpp falls back to an alternative snprintf() implementation if the OS does not provide a correct one.


^

Simple example

Sample main.cpp file that logs onto console and into file program.log. Loggers and appenders are created and configured manually. Example makes use of both function-style logging and stream-style logging.

// main.cpp

#include "log4cpp/Category.hh"
#include "log4cpp/Appender.hh"
#include "log4cpp/FileAppender.hh"
#include "log4cpp/OstreamAppender.hh"
#include "log4cpp/Layout.hh"
#include "log4cpp/BasicLayout.hh"
#include "log4cpp/Priority.hh"

int main(int argc, char** argv) {
	log4cpp::Appender *appender1 = new log4cpp::OstreamAppender("console", &std::cout);
	appender1->setLayout(new log4cpp::BasicLayout());

	log4cpp::Appender *appender2 = new log4cpp::FileAppender("default", "program.log");
	appender2->setLayout(new log4cpp::BasicLayout());

	log4cpp::Category& root = log4cpp::Category::getRoot();
	root.setPriority(log4cpp::Priority::WARN);
	root.addAppender(appender1);

	log4cpp::Category& sub1 = log4cpp::Category::getInstance(std::string("sub1"));
	sub1.addAppender(appender2);

	// use of functions for logging messages
	root.error("root error");
	root.info("root info");
	sub1.error("sub1 error");
	sub1.warn("sub1 warn");

	// printf-style for logging variables
	root.warn("%d + %d == %s ?", 1, 1, "two");

	// use of streams for logging messages
	root << log4cpp::Priority::ERROR << "Streamed root error";
	root << log4cpp::Priority::INFO << "Streamed root info";
	sub1 << log4cpp::Priority::ERROR << "Streamed sub1 error";
	sub1 << log4cpp::Priority::WARN << "Streamed sub1 warn";

	// or this way:
	root.errorStream() << "Another streamed error";

	return 0;
}
Console output for that example
1352973121 ERROR  : root error
1352973121 ERROR sub1 : sub1 error
1352973121 WARN sub1 : sub1 warn
1352973121 WARN  : 1 + 1 == two ?
1352973121 ERROR  : Streamed root error
1352973121 ERROR sub1 : Streamed sub1 error
1352973121 WARN sub1 : Streamed sub1 warn
1352973121 ERROR  : Another streamed error
^

Properties file example

Sample main.cpp file that makes use of logging configuration file log4cpp.properties

// main.cpp

#include <log4cpp/Category.hh>
#include <log4cpp/PropertyConfigurator.hh>

int main(int argc, char* argv[])
{
	std::string initFileName = "log4cpp.properties";
	log4cpp::PropertyConfigurator::configure(initFileName);

	log4cpp::Category& root = log4cpp::Category::getRoot();

	log4cpp::Category& sub1 = 
		log4cpp::Category::getInstance(std::string("sub1"));

	log4cpp::Category& sub2 = 
		log4cpp::Category::getInstance(std::string("sub1.sub2"));

	root.warn("Storm is coming");

	sub1.debug("Received storm warning");
	sub1.info("Closing all hatches");

	sub2.debug("Hiding solar panels");
	sub2.error("Solar panels are blocked");
	sub2.debug("Applying protective shield");
	sub2.warn("Unfolding protective shield");
	sub2.info("Solar panels are shielded");

	sub1.info("All hatches closed");

	root.info("Ready for storm.");

	log4cpp::Category::shutdown();

	return 0;
}

Configuration file for use with that code

# log4cpp.properties

log4cpp.rootCategory=DEBUG, rootAppender
log4cpp.category.sub1=DEBUG, A1, A2
log4cpp.category.sub1.sub2=DEBUG, A3

log4cpp.appender.rootAppender=ConsoleAppender
log4cpp.appender.rootAppender.layout=PatternLayout
log4cpp.appender.rootAppender.layout.ConversionPattern=%d [%p] %m%n 

log4cpp.appender.A1=FileAppender
log4cpp.appender.A1.fileName=A1.log
log4cpp.appender.A1.layout=BasicLayout

log4cpp.appender.A2=FileAppender
log4cpp.appender.A2.threshold=WARN
log4cpp.appender.A2.fileName=A2.log
log4cpp.appender.A2.layout=PatternLayout
log4cpp.appender.A2.layout.ConversionPattern=%d [%p] %m%n 

log4cpp.appender.A3=RollingFileAppender
log4cpp.appender.A3.fileName=A3.log
log4cpp.appender.A3.maxFileSize=200
log4cpp.appender.A3.maxBackupIndex=1
log4cpp.appender.A3.layout=PatternLayout
log4cpp.appender.A3.layout.ConversionPattern=%d [%p] %m%n 
Console output for that example
2012-11-14 18:44:58,163 [WARN] Storm is coming
2012-11-14 18:44:58,166 [DEBUG] Received storm warning
2012-11-14 18:44:58,170 [INFO] Closing all hatches
2012-11-14 18:44:58,172 [DEBUG] Hiding solar panels
2012-11-14 18:44:58,175 [ERROR] Solar panels are blocked
A3.log.1
2012-11-14 18:44:58,179 [DEBUG] Applying protective shield
2012-11-14 18:44:58,183 [WARN] Unfolding protective shield
2012-11-14 18:44:58,186 [INFO] Solar panels are shielded
2012-11-14 18:44:58,190 [INFO] All hatches closed
2012-11-14 18:44:58,192 [INFO] Ready for storm.

There are three loggers (including root) and three appenders. Root logger redirects all its own input and input of its descendant onto console. Descendant sub1 writes into two files, filtering output by message priority for second of them. Descendant sub1.sub2 writes also into rolling file. Log file A3.log is rolled over as soon as it reaches limit of 200 bytes, 1 backup log file is kept.

^

Git Repository

Log4cpp is hosted in a Git repository on SourceForge since version 1.1.1.

A mirror of the Git repository is also available on GitHub: https://github.com/log4cpp/log4cpp

To start working with a freshly checked out log4cpp repository, run ./autogen.sh first. This will generate the ./configure script and the required Makefile.in files. You will need at least autoconf 2.50, automake 1.6.0, and libtool 1.4 (the GNU Autotools build system).

Older versions of log4cpp (prior to 1.1.1) are available via CVS. See the SourceForge CVS page for instructions. The CVS repository is no longer maintained.

^

Releases

Each release will receive a tag named REL_x_y_z or prefixed with REL_x.y.z

Git tags

master branch (26 March 2026)
Fix Y2038 issue in Timestamp class (32-bit seconds field overflow). Use time_t for seconds to avoid truncation/overflow on platforms where time_t is 64-bit. Thanks to Adrien Destugues for reporting bug #153.
DailyRollingFileAppender: more detailed documentation, added safety checks to implementation, refine tests
Add compile-time printf format checking to Category logging methods. Enhance class log4cpp::Category to enable compile-time checking of printf-style format strings and arguments using compiler attributes. Fixes bug #155 reported by Adrien Destugues.
New logging level TRACE with priority value 800 for fine-grained diagnostic logging, trace-level methods and macros.
1.1.6 - master branch (12 March 2026)
CMake support is enhanced. Building examples is enabled via the CMake's LOG4CPP_BUILD_EXAMPLES option. CMake usage examples are provided for both scenarios: importing a CMake-installed log4cpp library and using log4cpp as a CMake subproject.
Emulate autotools behaviour when building via CMake and generate include/log4cpp/config.h from Autotools-style config.h.in
Add test build support using CTest
Add formatted and streaming log4cpp macros with compile-time stripping
vsnprintf: Use va_copy for C+11 and later; use __va_copy for GCC pre-C++11; fallback to simple copy
Native project files are archived to prevent MS VS from mixing old project files with CMake builds
1.1.5 - master branch (01 December 2025)
Cmake script update: support release and debug build types (defaults to release); build both static and shared libraries; pass necessary cpp macros for debug
MS Visual Studio 2022 can open log4cpp as CMake Project
Support for Embarcadero RAD Studio 12 in CMake script
Address bug #158; Add path to m4 macros for autoreconf in GNU Autotools scripts
Discussion 48226 by Andrew E Page. Alter CMakeLists to allow installation paths for x86 and arm64 be different so that cross-compilation on single host is possible.
Update scripts for GNU Autotools shipped with the log4cpp distribution to their fresh versions
Fixes for compilation warnings and spellings caught by Debian Patch
1.1.4 - master branch (01 May 2023)
fix for bug 152: use timespec and clock_settime for c++11 and higher; use stime for glibc version lower than 2.31; none for other cases
Replace obsolete auto_ptr removed in C++17 with newer unique_ptr since C++11
Replace older Non-throwing dynamic exception specification throw() removed in C++20 with newer noexcept since C++11
Patch #49 C99 compatibility fix for snprintf configure check
va_copy is here since c++11; fallback to simple copy if standard is not specified or less than c++11
1.1.3 - master branch (13 July 2017)
bug 146;
bug 147 - Being prepared for Removing Deprecated Exception Specifications from C++17
1.1.2 - master branch (18 April 2017)
Fixed memory leak after Category::shutdown() called: method Category::shutdownForced() releases memory allocated for appenders.
PropertyConfiguratorImpl: add target property to allow printing to STDERR.
Some fixes.
1.1.2rc1 - master branch (04 April 2015)
Small fixes, DailyRollingFile appender, tests, options to disable support for smtp and syslog
1.1.1 - stable branch (26 November 2013)
Small code and project file fixes.
1.1rc3 - development branch (18 October 2012)
Created build projects for MSVC10 (VS2010).
Small code fixes.
1.0 - master branch (03 September 2007)
Stable 1.0 release.
0.3.5 - master branch (12 April 2005)
Updating version to 0.3.5
0.3.4 - development branch (28 October 2002)
Fixed builds for MSVC6 and MSVC7.
Removed Log4cppCleanup.
0.3.3 - development branch (26 October 2002)
Fixed #628211: build failure on MSVC 6.0.
Fixed #625811: log facility in RemoteSyslogAppender.
Possibly fixed #415160: crashes with dynamic library on Solaris 2.6.
Replaced PatternLayout with a new, faster and more complete implementation.
0.3.2 - development branch (5 October 2002)
Fixed #614903: compilation problem on Sun CC 5.3.
Added missing MSVC6 .dsp files.
Fixed log facility in RemoteSyslogAppender.
Fixed relocatability of log4cpp-devel RPM.
0.3.2rc5 - development branch (5 October 2002)
Merged #604991: support for setting additivy in PropertyConfig.
Merged #605143: support for compilation in QNX Neutrino.
0.3.2rc4 - development branch (16 August 2002)
Fixed last minute goof ups which prevented compilation on both *nix and Win32 platforms.
0.3.2rc2 - development branch (12 August 2002)
Added support for POSIX threads.
Added PropertyConfigurator.
Rearranged documentation.
Fixed various bugs.
0.3.2rc1 - development branch (19 June 2002)
Support for Win32 threads added.
Added NTEventLogAppender.
Added Win32DebugAppender.
Fixed NDC context problem if depth > 2.
Added aclocal support.
0.3.1 - development branch (4 April 2002)
Added RollingFileAppender class.
Fixed bug #572467: invalidated iterator usage.
Fixed bug #527475: format string bug.
Fixed bug #530332: missing 'std::' specifiers.
Handled feature requests #536668, #527760, #527381.
0.3.0 - development branch (18 Februari 2002)
Added experimental support for multi threaded applications. This implementation uses omniORB4s threading library. Other threading libraries, such as Boosts, may be used as well, but this has not been implemented yet.
0.2.7 - stable branch (27 Januari 2002)
Support for multiple Appenders per Category added (feature request #501360).
Fixed variable scope bug in SyslogAppender (bug #499315)
Fixed memory leak in SyslogAppender and RemoteSyslogAppender (bug #499524)
Fixed compile problem in Filter (bug #)
Fixed config file parse problem in SimpleConfigurator (bug #500766)
Added methods for logging at FATAL level (bug #504314)
Fixed Win32 compile problem (bug #506907)
0.2.6 (11 December 2001)
Preliminary support for OpenVMS added.
PatternLayout, SimpleConfigurator and RemoteSyslogAppender added.
0.2.5 (11 June 2001)
Inclusion of support for Borland C++ Builder.
Library version 1.0.0: this release is not binary compatible with previous ones. (Version update should have been done in 0.2.4).
0.2.2 (04 March 2001)
Inclusion of Win32 platform (MSVC++ 6.0)
0.2.1 (15 Februari 2001)
license change to LGPL.
0.2.0 (10 December 2000)
log4cpp now uses autoconf and automake.
^

Status

The latest stable release is 1.1.6

log4cpp is moved to git since version 1.1.1, cvs is stale since then

Note for cvs: As of version 0.3.0 log4cpp had a separate 'stable' and 'development' branches. Releases x.y.z where y is even are considered stable and those where y is odd are experimental (which means that some or all features may be broken).

^

People

Coding on Log4cpp was initiated by me (Bastiaan Bakker) late 2000. Since then other people have joined the project or contributed code:

Cedric Le Goater <cedric(at)legoater.com> autoconf setup, various improvements
Marc Welz <marc(at)jade.cs.uct.ac.za> IdsaAppender
Lynn Owen <opl(at)agoby.com> MSVC++ support
Steve Ostlind <s.ostlind(at)pentasafe.com> MSVC++ support, various fixes
Marcel Harkema <marcel(at)debian.org> Debian packaging
Uwe Jäger <jaeger(at)varial.de> Borland C++ Builder support
Walter Stroebel <walter.stroebel(at)lifeline.nl> RemoteSyslogAppender
Glen Scott <glen_s(at)yahoo.com> PatternLayout, SimpleConfigurator
Tony Cheung <dragonman(at)asiayeah.com> OpenVMS support
Alex Tapaccos <ATapaccos(at)redfig.com> RollingFileAppender
Brendan B. Boerner <bboerner(at)texas.net> Multiple Appender support for Categories
Paulo Pizarro <paulo.pizarro(at)digitro.com.br> RollingFileAppender
David Resnick <dresnick(at)mobilespear.com> NTEventAppender, integration work
Aaron Ingram <ai8(at)yahoo.com> MSThreads support
Alan Anderson <alan(at)rushmore.com> Win32DebugAppender, PropertyConfigurator
Emiliano Martin <emilianomc(at)terra.es> PThreads support
Alexander Perepelkin <sanchouss_(at)users.sf.net> DailyRollingFileAppender. Project maintenance, improvements, fixes

^

Other projects

Log4cpp is one of many ports/implementations of the Log4j API. Here's an incomplete list:

log4c An implementation in C by Cedric Legoater
log4cplus An indepent C++ implementation by Tad Smith. Worth checking out if you don't like Log4cpp for some reason.

^