How i can disable qDebug() and console.log() logs in final release ?
-
wrote on 25 Feb 2019, 15:42 last edited by aha_1980
i want to disable all logs in c++ and qml in application which iam going to release.
//for example in c++ for debug purpose i have added something like this. qDebug() << "clicked!!";
//and in qml console.log("hello from app")
how i can disable these logs in final release without affecting the existing code?.
also i want to enable these whenever i want to debug .is this even possible ? .please let me know.
thanks. -
i want to disable all logs in c++ and qml in application which iam going to release.
//for example in c++ for debug purpose i have added something like this. qDebug() << "clicked!!";
//and in qml console.log("hello from app")
how i can disable these logs in final release without affecting the existing code?.
also i want to enable these whenever i want to debug .is this even possible ? .please let me know.
thanks.wrote on 25 Feb 2019, 15:44 last edited byHi @divaindie,
By putting this in your pro file (I'm not sure it works with qml console message, but I guess it is):
#No debug output in release mode CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
-
wrote on 25 Feb 2019, 15:57 last edited by
this works only for c++ not for QML .is there any similar way i can disable logs qml also by adding few lines in .pro file?
-
this works only for c++ not for QML .is there any similar way i can disable logs qml also by adding few lines in .pro file?
wrote on 25 Feb 2019, 16:23 last edited by@divaindie You can set environment variable QT_LOGGING_RULES=qml=false
For example by add in your main.cpp
#ifdef QT_NO_DEBUG_OUTPUT qputenv("QT_LOGGING_RULES", "qml=false"); #endif
Regards
Fabrice -
wrote on 25 Feb 2019, 16:53 last edited by
@KroMignon said in How i can disable qDebug() and consloe.log() logs in final release ?:
#ifdef QT_NO_DEBUG_OUTPUT
qputenv("QT_LOGGING_RULES", "qml=false");
#endifthanks !!! it is working !!!
1/5