How to enable qDebug messages for Qt

Advertisement

Advertisement

Qt has multiple levels of verbosity for logging. If you are able to print qInfo() messages but qDebug() is not outputting anything, you need to turn on the debug messages.

#include <QDebug>

...

qInfo() << "Is this working?";
qDebug() << "but not this?";

You can set the Qt logging levels in ~/.config/QtProject/qtlogging.ini like this:

# ~/.config/QtProject/qtlogging.ini
[Rules]
*.debug=true  # Enable all debug messages
qt.*.debug=false  # Disable qt debug messages, leaving only ours

Advertisement

Advertisement