How to disable qDebug ?
-
I am looking for suggestions on how / where to disable ALL qDebug outputs to "Application Output" view during "Run" .
I found this in another forum - but changing the QT_LOGGING_RULES does not compile when placed in header file. ( sorry the new error message posted BEFORE build does not copy something about C++ requires type specifier )
I did try to add same into main x.pro file in my "subdirs" project , it complied but did not stop qDebug from executing.
#ifndef PROJECT_COMMON_INCLUDE_H
#define PROJECT_COMMON_INCLUDE_H
#include <QLoggingCategory>
QT_LOGGING_RULES="*.debug=false"; thows C++ syntax error
#endif // PROJECT_COMMON_INCLUDE_H -
I am looking for suggestions on how / where to disable ALL qDebug outputs to "Application Output" view during "Run" .
I found this in another forum - but changing the QT_LOGGING_RULES does not compile when placed in header file. ( sorry the new error message posted BEFORE build does not copy something about C++ requires type specifier )
I did try to add same into main x.pro file in my "subdirs" project , it complied but did not stop qDebug from executing.
#ifndef PROJECT_COMMON_INCLUDE_H
#define PROJECT_COMMON_INCLUDE_H
#include <QLoggingCategory>
QT_LOGGING_RULES="*.debug=false"; thows C++ syntax error
#endif // PROJECT_COMMON_INCLUDE_H@AnneRanch
in your pro file addDEFINES += QT_NO_DEBUG_OUTPUT
disables qDebug() output
-
@AnneRanch said in How to disable qDebug ?:
QT_LOGGING_RULES="*.debug=false"; thows C++ syntax error
How do you expect that this does compile at all?
QT_LOGGING_RULES is an environment variable.
-
I am looking for suggestions on how / where to disable ALL qDebug outputs to "Application Output" view during "Run" .
I found this in another forum - but changing the QT_LOGGING_RULES does not compile when placed in header file. ( sorry the new error message posted BEFORE build does not copy something about C++ requires type specifier )
I did try to add same into main x.pro file in my "subdirs" project , it complied but did not stop qDebug from executing.
#ifndef PROJECT_COMMON_INCLUDE_H
#define PROJECT_COMMON_INCLUDE_H
#include <QLoggingCategory>
QT_LOGGING_RULES="*.debug=false"; thows C++ syntax error
#endif // PROJECT_COMMON_INCLUDE_H@AnneRanch
in your pro file addDEFINES += QT_NO_DEBUG_OUTPUT
disables qDebug() output
-
@J-Hilk Thanks Purfect , KISS and works .Just in case anybody is interested I found this after your post.
https://forum.qt.io/topic/73314/why-does-this-defined-qt_no_debug_output-not-supress-the-qdebug -
Hi,
Note that Qt categorized logging is a different beast that uses qCDebug and friends. They are the one you can use QT_LOGGING_RULES with.
-
Hi,
Note that Qt categorized logging is a different beast that uses qCDebug and friends. They are the one you can use QT_LOGGING_RULES with.
@SGaist said in How to disable qDebug ?:
Hi,
Note that Qt categorized logging is a different beast that uses qCDebug and friends. They are the one you can use QT_LOGGING_RULES with.
The article I read first did not make it clear if it works with module / class or make.
I am also looking at implementing
qSetMessagePattern(testPattern); // const QString &pattern)which is ever harder to figure out .
And it also kills qDebug....
-
From the QLoggingCategory documentation:
Logging rules can also be specified in a QT_LOGGING_RULES environment variable; multiple rules can also be separated by semicolons:
It's an environment variable.