Václav Haisman


log4cplus logo

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.

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.

Mission statement

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.


log4cplus 1.2.0-RC4 released

by Václav Haisman 2015-08-02

I have released log4cplus 1.2.0-RC4.

  • Fixed init_priority GCC attribute detection and use issue.

  • Fixed "most vexing parse" issue with LOG4CPLUS_C_STR_TO_TSTRING(STRING) when STRING is an identifier.`

  • Fixed AcceptOnMatch property function in filters default to true value.

  • Fixed GitHub bug #92. DailyRollingFileAppender rollover time was drifting.

  • Fixed GitHub bug #86. Create directories for lock file if CreateDirs is specified.

  • Allow turning off library name decoration in CMake builds. See also GitHub issue #98.

log4cplus 1.1.3-RC5 released

by Václav Haisman 2015-08-02

I have released log4cplus 1.1.3-RC5:

  • Fixed "most vexing parse" issue when using LOG4CPLUS_C_STR_TO_TSTRING().

  • Fixed AcceptOnMatch property function in filters default to true value.

  • Fixed GitHub bug #92. DailyRollingFileAppender rollover time was drifting.

  • Added LOG4CPLUS_ENABLE_DECORATED_LIBRARY_NAME option to CMake builds to produce log4cplus library without Unicode and/or static library decoration.

log4cplus 1.1.3-RC4 released

by Václav Haisman 2015-01-04

I have released log4cplus 1.1.3-RC4:

  • Allow negative maximal length in pattern specifier to make trimming of end instead of beginning possible. E.g., allow %.-1p to get initial letters of log level.

  • Visual Studio DLL builds now have a resource with basic information about the library. (Oskari Timperi)

  • LOG4CPLUS_*_FMT() macros can now be invoked with just formatting string, without additional arguments. (Zhang Shengfa)

  • Added setCurrentThreadName() and setCurrentThreadName2() to allow setting current thread name to custom string instead of the default stringified thread ID. (Zhang Shengfa)

log4cplus 1.2.0-RC3 released

by Václav Haisman 2015-01-04

I have just released log4cplus 1.2.0-RC3:

  • Fixed various issues related to unspecified behaviors which manifested when log4cplus was compiled using Clang.

  • SysLogAppender now recognize SyslogHost property as synonym for host property.

  • Improved compatibility of TTCCLayout with log4j's. Added ThreadPrinting, CategoryPrefixing and ContextPrinting configuration properties.

  • Allow negative maximal length in pattern specifier to make trimming of end instead of beginning possible. E.g., allow %.-1p to get initial letters of log level.

  • New appender TimeBasedRollingFileAppender. (Alexander Malinin)

  • LOG4CPLUS_*_FMT() macros can now be invoked with just formatting string, without additional arguments. (Zhang Shengfa)

  • Insert to/from string/log level conversion functions to the beginning of vector to favour user defined log levels and conversion functions.

log4cplus 1.2.0-RC2 released

by Václav Haisman 2014-06-12

I have released log4cplus 1.2.0-RC2. It contains only a small amount of changes relative to the previous 1.2.0-RC1 release:

  • Fixed bug #298. -- int to pointer cast error on Xcode 5.1.

  • Updated android/android.toolchain.cmake.

  • Documented issue and work-around for Android's emutls issue.

  • Do not set SOVERSION and VERSION properties for CMake based Android builds.

log4cplus 1.2.0-RC1 released

by Václav Haisman 2014-03-19

I have released log4cplus 1.2.0-RC1. It is based on new 1.2.x branch. There are many visible and less visible changes relative to the code of 1.1.x branch. Here are some highlights:

  • TraceLogger and associated LOG4CPLUS_TRACE_*() macros now record function name in generated event.

  • Added Qt5 based Qt5DebugAppender.

  • Added prototype of Python bindings using Swig 2.0+.

  • Autotools based build system has been converted from Makefile per directory to single Makefile for the whole project mode.

  • Plain text documentation files have been converted to Markdown (with Pandoc's extensions).

  • FileAppender can now create missing directories in log file path, if this is enabled by CreateDirs property.

  • Added MSTTSAppender that uses Windows' text-to-speech engine.

  • SysLogAppender can now log into remote syslog instance using TCP in addition to previously supported UDP.

  • Added Autotest based testsuite running and verifying output of existing tests/ directory tests. Improved tests coverage.

  • Many other small and bigger improvements.

log4cplus 1.1.3-RC2 released

by Václav Haisman 2014-03-19

I have released log4cplus 1.1.3-RC2. It contains only few changes:

  • Fixed bug #295 - infinite loop when underlying *printf() function returned EILSEQ.

  • Use PROJECT_SOURCE_DIR variable instead of CMAKE_SOURCE_DIR to allow using log4cplus as sub-project of another CMake project.

source code hosting has moved to Github

by Václav Haisman 2014-01-14

I have decided to migrate log4cplus source code hosting to Git on Github. The repository is at https://github.com/log4cplus/log4cplus. Bug tracker, etc., stays on SourceForge.

Why? Bazaar development is pretty much dead and SourceForge is not supporting it any more. Log4cplus can survive a bit longer with Bazaar on Launchpad but there are other things to consider:

  • Git seems to have won the DVCS wars, at least for next few years. Migrations to Git seem to be happening quite a lot while migrations from Git seem to be rare.

  • Using main stream DVCS might make log4cplus hacking more attractive and/or accessible to drive by contributors. According to some blogs and posts on mailing lists, some people consider working with Bazaar hard and Bazaar lacking some features they know from Git and they consider having to learn yet another DVCS to contribute few small patches too much.

  • It seems that Emacs development is going to move to Git soon (or is even in the process of moving now). This is migration from Bazaar to Git. That such important OSS project has decided to move from Bazaar to Git has made me thinking about log4cplus hosting and Bazaar, again.

  • I have recently been using Git through Emacs and magit and it was not that bad experience. (I still hate the Git CLI.)

  • I have shortly entertained the idea of moving to Mercurial but I have quickly dismissed it. It seems it would just postpone move to Git only for few months or years at best. Again, Git seems to have won the DVCS wars.

  • I would like to use the Travis CI integration that Github offers, without having to run a mirroring script on my home box.

log4cplus 1.1.3-RC1 released

by Václav Haisman 2013-12-31

I have released log4cplus 1.1.3-RC1. There are mainly portability fixes related to MinGW, iOS, Android and CMake:

  • Added --enable-symbols-visibility-options to configure script to allow turning off use of compiler and platform specific symbols visibility options.

  • Added ENABLE_SYMBOLS_VISIBILITY setting for CMake build system to the same effect as above.

  • Disabled LOG4CPLUS_INLINES_ARE_EXPORTED to fix linking issues on MinGW GCC 4.8.x.

  • Added LOG4CPLUS_BUILD_LOGGINGSERVER setting for CMake build system to allow disabling loggingserver. (Maxym)

  • Allow users overriding LOG4CPLUS_MACRO_FUNCTION.

  • Improved Android platform detection in CMake build system. (Maxym)

  • Allow overriding ConfigureChecks.cmake with user supplied file to help with issues on iOS platform.

  • Updated android.toolchain.cmake from OpenCV project.

  • Added iOS support to CMake build system. (Maxym)

  • Fixed compilation issue of single-threaded builds on Windows.

  • Improved CMake build system's default installation directories for GNU platforms by using GNUInstallDirs module.

log4cplus 1.1.2 released

by Václav Haisman 2013-10-22

I have released log4cplus 1.1.2. There are only few changes since 1.1.2-RC3:

  • Added AbstractSocket::shutdown().
  • Added missing documentation of MDC pattern layout converter.
  • Fixed bug #278 - TLS key leak.
  • Implemented %E{ENVVAR} pattern layout formatter for expansion of environment variables.

log4cplus web pages have moved

by Václav Haisman 2013-09-30

I have moved the content of log4cplus.sourceforge.net web pages to log4cplus's wiki on SourceForge.

log4cplus 1.1.2-RC3 released

by Václav Haisman 2013-09-29

I have just released log4cplus 1.1.2-RC3. It contains mainly portability fixes:

  • Fixed build issues on HP-UX with aCC.
  • Fixed build issues on Haiku.
  • Added mingw-log4cplus.spec to allow cross-compilation from Fedora. (John Smits)
  • Fixed build issues on AIX with XLC.
  • Fixed build issues related to Microsoft's foo_s() functions with some version of MinGW tool-chain.
  • Tiny speedup of getFormattedTime().
  • Imported newer android/android.toolchain.cmake from OpenCV repository.

moving source code hosting to Launchpad.net

by Václav Haisman 2013-07-15

As SourceForge is not going to support Bazaar anymore, I have decided to move log4cplus source code hosting from SourceForge to Launchpad.net. I have decided to stick with Bazaar for some more time instead of moving to Github because it simply requires less effort than having to start using Git and Github. I am moving only the source code repository. Everything else (bug tracker, pages, etc.) stays on SourceForge.

log4cplus trunk mirror on Github

by Václav Haisman 2013-07-04

Per popular request, I have set up a mirror of log4cplus trunk on Github.

The mirror is updated hourly by a cron job on my box, so it should be fairly up to date. At this point, the mirror is one way only, from SourceForge to Github.

log4cplus 1.1.2-RC2 released

by Václav Haisman 2013-07-03

  • Fixed crash of DLL builds on Windows when _WIN32_WINNT>=0x0600.
  • Roll log file both before and after append to avoid logging into stale file when the log file has already been rolled by another logging process.
  • Known issue: Logging into a single log file from multiple processes on Windows breaks the rolling of the log files because open files cannot be renamed.
  • Fixed bug #166 - Close appender only once even when it is used by multiple loggers.

log4cplus 1.1.2-RC1 released

by Václav Haisman 2013-05-29

I have released log4cplus 1.1.2-RC1. The changes relative to 1.1.1 are one bug fix and a pair (--enable-so-version and --enable-release-version) of configure script options. It is now possible to build undecorated liblog4cplus.so, using the negative variants of the two options.

  • Fixed bug #163 - Initialization issue.

  • Added --enable-so-version and --enable-release-version configure script options to allow production of undecorated binaries.

log4cplus 1.1.1 released

by Václav Haisman 2013-05-01

I have released log4cplus 1.1.1. There are both bug fixes and small new features relative to 1.1.0. Please see ChangeLog or log4cplus 1.1.x branch changes for detailed list of changes.

log4cplus 1.1.1-RC4 released

by Václav Haisman 2013-03-30

I have released log4cplus 1.1.1-RC4. This is mostly a bug fix release but there are also some small new features.

  • Fixed bug #156 - Messages are truncated when produced using the LOG4CPLUS_*_FMT() macros.
  • Fixed bug #157 - Fedora package build failure.
  • Improved log4cplus initialization:
    • Use APC to initialize log4cplus outside loader lock.
    • Use Microsoft C runtime library TLS callbacks to initialize log4cplus as static library.
    • Warn during compilation that automatic initialization is not possible when log4cplus is being compiled with static Microsoft C runtime library.
    • Provide log4cplus::initialize() function to allow users to initialize log4cplus in situations where automatic initialization is not possible.
  • Several improvements to CMake build:
    • Fixed OpenBSD + CMake builds.
    • Fixed issues with Visual Studio 2005 CMake builds.
    • Added support for CMake builds on Android with NDK. (Sergey Nikulov)
    • The defines.hxx.cmake file is now generated out of defines.hxx.in.
    • Library version is parsed out of version.h. (Sergey Nikulov)
  • MDC formatter for PatternLayout ("%X") now expands into list of key value pairs if no specific key is given. (Yaqian Shen)
  • Avoid clock_nanosleep() on Android.
  • ServerSocket::accept() can now be interrupted from another thread using new function ServerSocket::interruptAccept().

log4cplus released

by Václav Haisman 2013-02-26

I have released log4cplus It is a minor release fixing two issues found on Solaris with Solaris Studio.

  • Fixed bug #125 - Build failure with Solaris Studio on Solaris, threading detection problem.
  • Fixed bug #161 - Compilation problem due to missing towupper() and towlower() in global namespace.

log4cplus 1.1.1-RC3 released

by Václav Haisman 2013-01-23

I have released log4cplus 1.1.1-RC3. It contains more fixes related to
portability to MinGW and most importantly, a fix to broken Windows builds.


News: 2013/09/log4cplus-web-pages-have-moved
Wiki: BugReportingInstructions
Wiki: CodeExamples
Wiki: Development
Wiki: ProjectStatus
Wiki: README-1.1.3
Wiki: Release