Changing debug log level
-
wrote on 6 Jan 2019, 07:16 last edited by
Is there any way, preferably from QML, to change the debug log level to suppress harmless warnings? I've got some QML GridLayout stuff that complains about cells already being taken, and they're cluttering up the log when I'm trying to use the log for my own debugging.
(FYI, GridLayout objects have a particular limitation when dealing with items that span multiple cells, which I was only able to work around by overlapping them with dummy items. So I can't accomplish the formatting I need without provoking these harmless but annoying warnings.)
-
wrote on 7 Jan 2019, 07:57 last edited by pderocco 1 Jul 2019, 07:59
@sierdzio Thanks. Using this in main.cpp:
QLoggingCategory::setFilterRules("*.warning=false");
suppresses the warnings, but allows my console.log stuff to come through. I'd like to be more specific, but it appears that qgridlayoutengine.cpp uses QWarning(), which implies the "default" category, so even if I change the wildcard to "default", it's probably still going to filter out most warnings I might get in the future. I wish there was a way to install a regex filter on the log output.
-
See logging category docs.
-
Is there any way, preferably from QML, to change the debug log level to suppress harmless warnings? I've got some QML GridLayout stuff that complains about cells already being taken, and they're cluttering up the log when I'm trying to use the log for my own debugging.
(FYI, GridLayout objects have a particular limitation when dealing with items that span multiple cells, which I was only able to work around by overlapping them with dummy items. So I can't accomplish the formatting I need without provoking these harmless but annoying warnings.)
I think that only QML can't stop warning from library.
In mixed C ++ and QML project case, it may be stop by adding QT_NO_WARNING_OUTPUT at CONFIG.
http://doc.qt.io/qt-5/debug.html#warning-and-debugging-messagesand additional information, I use original log output at "LoggingCategory QML Type" in QML.
https://doc.qt.io/qt-5/qml-qtqml-loggingcategory.html -
wrote on 7 Jan 2019, 07:57 last edited by pderocco 1 Jul 2019, 07:59
@sierdzio Thanks. Using this in main.cpp:
QLoggingCategory::setFilterRules("*.warning=false");
suppresses the warnings, but allows my console.log stuff to come through. I'd like to be more specific, but it appears that qgridlayoutengine.cpp uses QWarning(), which implies the "default" category, so even if I change the wildcard to "default", it's probably still going to filter out most warnings I might get in the future. I wish there was a way to install a regex filter on the log output.
-
You can install your own filter (see next section under my link), but that will be cumbersome.
Or you can patch your Qt sources and insert a logging category in that file, then filter it out.
It would also be good to fix this upstream - feel invited to open a bug report for last of category in layout engine.
1/5