Skip to content
View log4cpp's full-sized avatar

Block or report log4cpp

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
log4cpp/README.md

log4cpp

Build latest master with CMake, run Ctest on Linux, Windows, MacOS

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.

Features

  • Multiple log levels (DEBUG, INFO, WARN, ERROR, FATAL, ...)
  • Thread-safe logging
  • Customizable log format
  • Console and file appenders, including:
    • Size-based rolling files
    • Daily rolling files
    • Syslog
    • IDSA
    • SMTP
    • Windows Event Log
  • No external dependencies
  • Cross-platform (Linux, macOS, Windows)
  • Build support with Autotools, CMake

Installation

Download source code

Option 1 - Download a Release from SourceForge

Choose the latest stable version or a recent release candidate.

Option 2 - Clone the Git Repository SourceForge or GitHub

Get the latest version of the source code:

git clone https://github.com/log4cpp/log4cpp.git

Build with Autotools

./autogen.sh  # optional
./configure
make
make check
make install

Build with CMake

cmake -S . -B build_release -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/.local -DLOG4CPP_BUILD_EXAMPLES=ON
cmake --build build_release
cd build_release/tests; ctest
cd ../..; cmake --install build_release

Other Build Methods

Additional build methods are listed on the project website (http://log4cpp.sf.net/).

Using in your CMake project

CMake usage examples are provided for two scenarios:

Building examples is enabled via the LOG4CPP_BUILD_EXAMPLES configuration option (-DLOG4CPP_BUILD_EXAMPLES=ON). Both shared and static library variants are demonstrated. The CMake usage examples can be built either:

  • as part of the log4cpp build (when LOG4CPP_BUILD_EXAMPLES is enabled), or
  • as standalone CMake applications that import or include log4cpp from their own directories. To build an example as a standalone application, change into the example directory and build it separately with CMake.
    cd examples/cmake_usages/log4cpp_as_subproject 
    cmake -S . -B build
    cmake --build build
    cd examples/cmake_usages/log4cpp_as_package    
    cmake -S . -B build -DCMAKE_PREFIX_PATH=$HOME/.local # possible after log4cpp was installed with CMake  
    cmake --build build

Popular repositories Loading

  1. log4cpp log4cpp Public

    Mirror of SourceForge project https://log4cpp.sf.net

    C++ 2