Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Behaviour of qDebug and companions starting with Qt 5.2
koahnig last edited by koahnig
qDebug and its companions are quite powerful methods for substitution of cout and cerr in applications.
Two advatanges made it quite appealing when I have started to use probably around Qt 4.6 or even earlier.
The first advantage is that you can finally use a macro define for switching all references off.
The other is that the output may easily redirected at a central point of your application. The outpout may be split and duplicated what ever the programmer decides with respect to output seem possible.
Therefore, I started to use qDebug already using it as some type of logging feature before it became an official part of Qt 5.2 with QLogging.
Currently, I am using Qt5.3 and the functionality is still the same with my applications after adaption of the slight changes with the message output handler.
However, one point bothers a bit. That is that the current implementation in Qt 5.3 reinterprets all qDebug statements through a macro in qlogging.h
qDebug, qWarning, qCritical, qFatal are redefined to automatically include context information
#define qDebug QMessageLogger(
#define qWarning QMessageLogger(
#define qCritical QMessageLogger(
#define qFatal QMessageLogger(
The issue is the
_in those defines. They pepper the release exe with references to the source code files. In turn that is not what one really anticipates with a release build.
Is there already a better way of handling anticipated?
Or do we need to overwrite those defines individually in our code files?