How to disable Qt debug messages
-
My project was compiled with Qt 5.4.2, I have recently upgraded it by compiling with 5.10.1
Since it's compiled with 5.10.1 I have a lot of verbose logs such as :
[2018.08.17 16:49:18:440]D: Generating leave event for QWidgetWindow(0x28edb550, name="MainWindowWindow") [2018.08.17 16:49:20:404]D: Entering QWidgetWindow(0x28edb550, name="MainWindowWindow") [2018.08.17 16:49:20:772]D: WM_MOUSELEAVE for QWidgetWindow(0x28edb550, name="MainWindowWindow") previous window under mouse = QWidgetWindow(0x28edb550, name="MainWindowWindow") tracked window = QWidgetWindow(0x28edb550, name="MainWindowWindow") [2018.08.17 16:49:20:777]D: Generating leave event for QWidgetWindow(0x28edb550, name="MainWindowWindow")
I have disabled it by writing :
*.debug = false
in Rules in the qtlogging.ini file.
It works well but I don't have my own qDebug messages anymore. How can I disable Qt framework messages debug only ?
-
My project was compiled with Qt 5.4.2, I have recently upgraded it by compiling with 5.10.1
Since it's compiled with 5.10.1 I have a lot of verbose logs such as :
[2018.08.17 16:49:18:440]D: Generating leave event for QWidgetWindow(0x28edb550, name="MainWindowWindow") [2018.08.17 16:49:20:404]D: Entering QWidgetWindow(0x28edb550, name="MainWindowWindow") [2018.08.17 16:49:20:772]D: WM_MOUSELEAVE for QWidgetWindow(0x28edb550, name="MainWindowWindow") previous window under mouse = QWidgetWindow(0x28edb550, name="MainWindowWindow") tracked window = QWidgetWindow(0x28edb550, name="MainWindowWindow") [2018.08.17 16:49:20:777]D: Generating leave event for QWidgetWindow(0x28edb550, name="MainWindowWindow")
I have disabled it by writing :
*.debug = false
in Rules in the qtlogging.ini file.
It works well but I don't have my own qDebug messages anymore. How can I disable Qt framework messages debug only ?
-
@bam500
I shall be interested for an alternative answer here, because my understanding is that the internals just useqDebug()
like you do, and if you want your own you will get theirs automatically too.... -
there is
DEFINES += QT_NO_DEBUG_OUTPUT
that you can add to your pro file. It stops any code with qDebug() in it from being executed.You can even condition it, so that for example, you get debug output during debug builds, but non in release.
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
however, be careful.
something likeQFile f(/path/patch/etc), qDebug() << f.open();
may very well break your code.
-
there is
DEFINES += QT_NO_DEBUG_OUTPUT
that you can add to your pro file. It stops any code with qDebug() in it from being executed.You can even condition it, so that for example, you get debug output during debug builds, but non in release.
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
however, be careful.
something likeQFile f(/path/patch/etc), qDebug() << f.open();
may very well break your code.
@J.Hilk
I don't understand how this helps? The problem is that there are existingqDebug()
statements in internal Qt code, which the user does not want output, and explicitqDebug()
in his own code, which he does want output. That's why I wrote my post above. -
@J.Hilk
I don't understand how this helps? The problem is that there are existingqDebug()
statements in internal Qt code, which the user does not want output, and explicitqDebug()
in his own code, which he does want output. That's why I wrote my post above.