Qt - Enabling qDebug messages and Qt Creator

I have been struggling for the past two hours to get qDebug() messages from my Qt 5 application to show up on the 'Application output' pane in Qt Creator IDE on Linux. Finally I found a solution, thanks to a user on Qt IRC channel.

To enable log messages in Qt, do the following:

Edit ~/.config/QtProject/qtlogging.ini and make sure it has:

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


With this, I was getting the messages when I run the application from a terminal. But Qt Creator was not showing the qDebug() messages.


To have the messages displayed in Qt Creator, do the following:

Qt creator > Tools > Options > Kits, select your kit, find Environment, click change and add:
QT_ASSUME_STDERR_HAS_CONSOLE=1

This fixed the problem for me. I thought I should document the full process here as Google wasn't getting me good leads.

My environment:
Fedora 29 Linux x86-64
Qt 5.11.3
Qt Creator v4.7.2


References:
https://bugzilla.redhat.com/show_bug.cgi?id=1227295
https://www.devdungeon.com/content/how-enable-qdebug-messages-qt
https://bugreports.qt.io/browse/QTBUG-66153

Comments

  1. Thanks bud, that helped on arch linux too,

    ReplyDelete
  2. If you get errors on the Application Output window related to
    kf.windowsystem or anything starting with kf.

    Add this rule in qtlogging.ini as well
    kf.*=false

    I also got some more output so you might also want to add this rule as well
    qt.qpa*=false

    Hoping this helps someone else.
    This blogpost saved me a ton of time when I started out, thanks for that :)

    -pk

    ReplyDelete
  3. Merci Merci Merci ...... je suis sous Archlinux et cette configuration est LA solution et j'ai cherché longtemps.

    ReplyDelete
  4. Not working on Manjaro in 2023. Also this shit should work out of the box. Fuck.

    ReplyDelete
    Replies
    1. I just tested on a newly installed Fedora 38. Works fine.

      Delete
    2. I meant, the steps mentioned in the blog post worked fine on Fedora 38.

      Delete

Post a Comment

Popular posts from this blog

പേര്

ബിഗ് റേഡിയോ ഇതിഹാസം