Log4Qt is a C++ port of the Apache Software Foundation Log4j package using the
Trolltech Qt Framework. It is intended to be used by open source and commercial
The documentation describes classes and methods that have been added or changed
compared to Log4j. The documentation was generated from the source code using
Doxygen. It can be accessed here.
How to use
To use Log4Qt within your software project include the Log4Qt source into your project
Download the package from the
SourceForge project page
Unpack the Log4Qt package
Add the log4qt source to the Qt project file by adding the following line
Include the Logger class, a layout and an appender class to configure Log4Qt to generate output. The example uses the ConsoleAppender with a TTCCLayout
Configure a logger to generate output. The example uses the root logger
// Create a layout
TTCCLayout *p_layout = new TTCCLayout();
// Create an appender
ConsoleAppender *p_appender = new ConsoleAppender(p_layout, ConsoleAppender::STDOUT_TARGET);
// Set appender on root logger
Request a logger by either calling Log4Qt::Logger::logger or using LOG4QT_DECLARE_QCLASS_LOGGER
// Request a logger and output "Hello World!"
Log4Qt::Logger::logger(QLatin1String("My Logger"))->info("Hello World!");
0.3 - 01 March 2009
Bug fixes, compatibility with VS 2008 and Qt 4.5 RC1
Fixed a problem where the pParent parameter of the constructor was not passed on to the QObject constructor (logobject.h)
Fixed a problem were OptionConverter::toBoolean would not return the default value, if the conversion fails (optionconverter.cpp)
Fixed a compile error on VS 2008 by using Q_UNUSED(&rEvent) instead of Q_UNUSED(rEvent) (varia/denyallfilter.h.h)
Fixed VS 2008 unreferenced formal parameter warning by using Q_UNUSED (logmanager.cpp, mdc.cpp, ndc.cpp, propertyconfigurator.cpp, helpers/initialisationhelper.cpp, helpers/patternformatter.cpp)
0.2 - 30 January 2009
Bug fixes and compatibility with Qt 4.4
Added a compile time version check for the Qt version (log4qt.h)
Replaced usage of q_atomic_increment and q_atomic_decrement with QAtomicInt for compilation with Qt 4.4 (helpers/logobject.h)
Replaced usage of q_atomic_test_and_set_ptr with QAtomicPointer for compilation with Qt 4.4 (logger.h, helpers/classlogger.cpp, helpers/classlogger.h, helpers/initialisationhelper.h)
Fixed a problem with Qt 4.4 where QReadWriteLock is by default non-recursive (hierarchy.cpp, logger.cpp)
Resolved compilation problem with Microsoft Visual Studio 2005 (logmanager.cpp, helpers/datetime.cpp)
0.1 - 29 December 2007
The Eclipse CDT console does not display the log output of a correctly
when using a ConsoleAppender with a TTCCLayout and relative time format.
The millisecond count is stripped from the output.
Log4Qt is licensed under the
Apache License Version 2.0.
Log4Qt requires the Qt framework that is available under several licensing options
The package is intended to be used under the
Nokia Corporation Qt GPL Exception.
||XX February 2009, Martin Heinrich