Log4Qt is a C++ port of the Apache Software Foundation Log4j package using the Qt Framework. It is intended to be used by open source and commercial Qt projects.
http://log4qt.sourceforge.net/
This Log4Qt repository is a clone of the Log4Qt repository from https://gitorious.org/log4qt which was itself a clone of the original Log4Qt project on SourceForge http://sourceforge.net/projects/log4qt/ (http://log4qt.sourceforge.net/).
- SimpleTimeLayout (“dd.MM.yyyy hh:mm [Thread] Level Logger Message”)
- ColorConsoleAppender (render colorized message by escape sequence and put it to console)
- SignalAppender (emit signal when log event happens)
- DatabaseAppender (append log event into sql table)
- DatabaseLayout (put log event into sql table columns)
- Telnet appender (append log event to telnet clients)
- LogStream (qDebug()-style log messages appending)
- MainThreadAppender (Proxy appender for sending log messages through event loop)
- XMLLayout to support apache chainsaw
- DailyFileAppender which generates a logfile for each day (add current date formatted to the filename)
- Binary logger
- Windows Debug Console Appender
- Minimum Qt version required Qt5.12 (for support of Qt versions down to 5.3 use branch 1.4 or the lates 1.4.x release or for support of Qt versions down to 5.7 use branch 1.5 or the lates 1.5.x release)
- C++11 feature required (minimum compiler version MSVC14, GCC 4.8 or CLANG 3.3)
Apache License 2, Version 2.0
git clone https://github.com/MEONMedical/Log4Qt.git
use qmake to build the project
*NIX
qmake
make
make install
WIN* (mingw)
qmake
mingw32-make
mingw32-make install
WIN* (msvc)
qmake
msbuild Log4Qt.sln
msbuild /t:INSTALL Log4Qt.sln
For static build call qmake with
qmake "DEFINES+=LOG4QT_STATIC" or uncommend LOG4QT_STATIC in the build.pri file
Don't forget to define LOG4QT_STATIC also in your project.
Logging to a database via databaseappender can be enabled with qmake "QT += sql"
By default the macOS build targets qmake's detected host architecture
(QMAKE_HOST.arch). This normally matches the physical machine (arm64 on
Apple Silicon, x86_64 on Intel), but reflects the architecture of the qmake
binary itself — e.g. an x86_64 qmake run under Rosetta on Apple Silicon will
default to x86_64.
qmake
make
make install
To target a specific architecture instead (e.g. cross-building x86_64 on an
Apple Silicon host, or vice versa), pass QMAKE_APPLE_DEVICE_ARCHS on the
qmake command line:
*NIX (macOS, Apple Silicon)
qmake "QMAKE_APPLE_DEVICE_ARCHS=arm64"
make
make install
*NIX (macOS, Intel)
qmake "QMAKE_APPLE_DEVICE_ARCHS=x86_64"
make
make install
To build a universal (fat) binary containing both architectures in one pass, list them space-separated:
qmake "QMAKE_APPLE_DEVICE_ARCHS=arm64 x86_64"
make
make install
Building each architecture separately (rather than as a single universal
binary) is required when packaging separate per-arch Conan packages, e.g.
-s arch=armv8 and -s arch=x86_64 for the Macos conan setting.
Can also be used by adding the log4qt source directly to your Qt project file by adding the following line: include(/src/log4qt/log4qt.pri)
cmake is the second option to build Log4Qt. An out-of-source build is required: <unpack/fetch to Log4Qt directory> mkdir Log4Qt-build cd Log4Qt-build cmake ../Log4Qt make/mingw32-make/msbuild Log4Qt.sln (same as with qmake) make/mingw32-make install or: msbuild /t:INSTALL Log4Qt.sln
Addition cmake options are
* '-DBUILD_STATIC_LOG4CXX_LIB=ON|OFF' to build static log4qt lib (default: OFF)
* '-DBUILD_WITH_DB_LOGGING=ON|OFF' to build with database logging support