Unable to see the QDebug Messages on console.
-
@Rohith ,
Add,
CONFIG += console -
@Rohith
You need to add CONFIG type in profile, as shown
TEMPLATE = app
TARGET = CndM
INCLUDEPATH += .
QT+= core widgets gui sql
CONFIG += consoleInput
HEADERS += database.h widget.h
FORMS += widget.ui
SOURCES += database.cpp main.cpp widget.cpp -
Hi yuvaram and vijay thanks for replying, i have tried as per your suggestion but no use i am unable to see the qdebug messages.
my new .pro file
TEMPLATE = app TARGET = CndM INCLUDEPATH += . QT+= core widgets gui sql CONFIG += console # Input HEADERS += database.h widget.h FORMS += widget.ui SOURCES += database.cpp main.cpp widget.cpp
-
-
@Rohith ,
Try compiling your code through Qt Creator, and check the qDebugs in application output?
-
Hi, also, as a workaround, you can capture all qDebug messages and print them out yourself, just call qInstallMessageHandler, say like this:
#include "stdio.h" void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { printf(qUtf8Printable(msg)); printf("\n"); } int main(int argc, char *argv[]) { qInstallMessageHandler(messageHandler); QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
-
Hi @Rohith,
i am unable to see the debug messages on the linux console
Try running your application after:
export QT_LOGGING_RULES="*.debug=true"
The default message handler decides whether or not to filter debug messages (indeed, all log categories and/or levels) based on rules loaded in five different places (see "Order of evaluation" under QLoggingCategory - Logging Rules). And recent versions of Linux (Ubuntu at least, and Fedora I've read) ship with debug output disabled by default. You can enable debug output a number of ways (see the previous link), and can even decide which components to log at which levels (eg enable debug logging of Qt's network components if you wish). It's pretty powerful, but a little bit complex IMO.
Another way is:
QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, true);
I sometimes like to do that in response to a
-d
or--debug
command line option.Cheers.
-
correct @Paul-Colby
thanks