Skip to content

Instantly share code, notes, and snippets.

@brianclinkenbeard
Last active October 6, 2017 05:15
Show Gist options
  • Save brianclinkenbeard/51d105e188c256e5f837565c5505d3d6 to your computer and use it in GitHub Desktop.
Save brianclinkenbeard/51d105e188c256e5f837565c5505d3d6 to your computer and use it in GitHub Desktop.
No qDebug() Output in Qt Creator on GNU/Linux

No qDebug() Output in Qt Creator on GNU/Linux

It seems that at the time of writing, some GNU/Linux distributions will not show the output of qDebug() calls by default within the Application Output section of Qt Creator. This happens despite qWarning() working perfectly.

The Problem

The issue here lies in /etc/xdg/QtProject/qtlogging.ini:

[Rules]
*.debug=false

According to Kevin Kofler at Fedora:

This is by design. Our users do not want to get spammed with debugging output by default. It is easy for developers to enable it. (We are also working on packaging the GUI KDE now ships for editing qtlogging.ini to make it even easier.)

Bringing Back qDebug() Output

Do not edit the file within /etc/xdg/QtProject as it will likely get changed back when your package manager updates whatever provides the file. Instead we will add a new qtlogging.ini local to the home directory of the user that you run Qt Creator on.

Add the following contents to ~/.config/QtProject/qtlogging.ini:

[Rules]
*.debug=true
qt.*.debug=false

Here we set *.debug=true to allow all debug output. Then we set qt.*.debug=false to prevent us from receiving the verbose output from Qt itself rather than the qDebug() calls within your project.

It is worth noting that the file above will simply change Qt Creator to its default behavior if you do not already have a qtlogging.ini provided by your distribution. If you find your distribution removes this file, your new qtlogging.ini in ~/.config is redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment