Qt / KDE Controlling Debug Messages# 5 Jan 2023
Here you can find some simple notes on how to debug Qt / KDE applications. My focus is on OpenBSD as host system but everything here should work on GNU/Linux.
kDebug() and friends have been deprecated in KDE Frameworks 5 so you have to
use the recommended logging functions
qCCritical(category) to create logs from Qt5/Qt6 applications.
Since Qt 5.2 QLoggingCategory
is available to configure the category and allows us to control the output.
We can control it as follows and this is also the sequence as they are evaluated.
In my default setup I disabled all debug logging in
~/.config/QtProject/qtlogging.ini by a simple rule like this:
and enable step by step by
QT_LOGGING_RULES what I want to see. For example,
debug KDE Frameworks
QT_FORCE_STDERR_LOGGING is a other useful environment variable to help you
to debug from terminal. This ensure all your logs are going to stderr instead
syslog or journald.
A common case is to see default debug messeages without a category like:
qDeug() << "Simple deug log message". This is possible due to the simple
The pattern is always the same. Search for
identify the log name and filter it with
Here you can find example: codesearch.debian.net - Q_DECLARE_LOGGING_CATEGORY
You can set the QT_LOGGING_DEBUG environment variable to find out where your logging rules are loaded from.
For more informations checkout QLoggingCategory docs.