Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. qDebug() not working.

qDebug() not working.

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
11 Posts 3 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    davidwedel
    wrote on last edited by davidwedel
    #1

    If this is in the wrong category, feel free to move it over.

    I recently installed a new fedora 40 os. I'm running cmake 3.28.2. (the default cmake in dnf.) Qt 6.7.2. On this computer, I can not get qDebug() to print at all. Even just running cmake/make from the terminal doesn't get any reaction. qWarning, and qInfo both work as expected.

    I move over to my "old" computer, running Qt 6.7.0, (installed through the online installer), and cmake 3.22.1. There, qDebug() works correctly.

    Did something with cmake change in the last several releases, since 3.22? I've tried setting the configuration to debug, etc, and haven't gotten anywhere. The application compiles and runs correctly, just no qDebug(). Code is here. https://github.com/Davidwedel/QtAgOpenGPS/tree/agio_dev

    Any advice will be much appreciated!

    1 Reply Last reply
    0
    • D Offline
      D Offline
      davidwedel
      wrote on last edited by davidwedel
      #2

      Update. I really don't know what to try next. I've edited the qtlogging.ini. I've tried to find the most basic QT/cpp applications online. Everything compiles and runs just fine. qWarning() and qInfo() work. But qDebug() will never show up. std::cout << "etc";seems to work just fine.

      JonBJ 1 Reply Last reply
      0
      • D davidwedel

        Update. I really don't know what to try next. I've edited the qtlogging.ini. I've tried to find the most basic QT/cpp applications online. Everything compiles and runs just fine. qWarning() and qInfo() work. But qDebug() will never show up. std::cout << "etc";seems to work just fine.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @davidwedel
        So start by writing a standalone 4 line program which uses qDebug() instead of that enormous project. Then you will know whether there is some issue with qDebug() itself or maybe the flags you use to compile. Assuming not then either there is something in your project's code or in the options/defines used to compile it.

        One thing you could check is whether your big project uses QtMessageHandler qInstallMessageHandler(QtMessageHandler handler). That can be used to handle/redirect output from qDebug() and the other related macros. It also mentions "QT_NO_DEBUG_OUTPUT have been set during compilation", check that is not the case. If your code does not install a message handler do so now temporarily to see whether this is being called with QtDebugMsg.

        1 Reply Last reply
        3
        • D Offline
          D Offline
          davidwedel
          wrote on last edited by
          #4

          OK so I got a few things figured out! I did indeed have QT_NO_DEBUG_OUTPUT (set to off I thought) in my CMakeLists.txt. Removed that. Still no joy. Then, went to /usr/share/qt6/qtlogging.ini, and set *.debug=true. Then, the qDebug() logging worked correctly in the basic 4 line program, as well as the QtMessageHandler when added to the 4 line program(by the way, the big project doesn't use QtMessageHandler, though that might change :). But when I go to the big program, the console is completely flooded with all kinds of debug info with all things Qt related. Here's a sample.

          qt.quick.layouts: QQuickGridLayoutBase::rearrange 0 QQuickRowLayout(0x2456f2f0, id="sensorsWindow", parent=0x2456ecf0, geometry=0,0 0x80)
          qt.quick.layouts: "" QQuickGridLayoutBase::rearrange() QSizeF(0, 80)
          qt.quick.layouts: LEAVE QQuickLayout::ensureLayoutItemsUpdated() QQuickRowLayout(0x2456f2f0)
          qt.quick.layouts: QQuickGridLayoutBase::rearrange 0 QQuickRowLayout(0x2456f2f0, id="sensorsWindow", parent=0x2456ecf0, geometry=0,0 0x80)
          

          I can disable this by setting *.debug=false but then I don't get any qDebug() logs. But now, the console fills up much too fast to even read the logs I want.

          jeremy_kJ JonBJ 2 Replies Last reply
          0
          • D davidwedel

            OK so I got a few things figured out! I did indeed have QT_NO_DEBUG_OUTPUT (set to off I thought) in my CMakeLists.txt. Removed that. Still no joy. Then, went to /usr/share/qt6/qtlogging.ini, and set *.debug=true. Then, the qDebug() logging worked correctly in the basic 4 line program, as well as the QtMessageHandler when added to the 4 line program(by the way, the big project doesn't use QtMessageHandler, though that might change :). But when I go to the big program, the console is completely flooded with all kinds of debug info with all things Qt related. Here's a sample.

            qt.quick.layouts: QQuickGridLayoutBase::rearrange 0 QQuickRowLayout(0x2456f2f0, id="sensorsWindow", parent=0x2456ecf0, geometry=0,0 0x80)
            qt.quick.layouts: "" QQuickGridLayoutBase::rearrange() QSizeF(0, 80)
            qt.quick.layouts: LEAVE QQuickLayout::ensureLayoutItemsUpdated() QQuickRowLayout(0x2456f2f0)
            qt.quick.layouts: QQuickGridLayoutBase::rearrange 0 QQuickRowLayout(0x2456f2f0, id="sensorsWindow", parent=0x2456ecf0, geometry=0,0 0x80)
            

            I can disable this by setting *.debug=false but then I don't get any qDebug() logs. But now, the console fills up much too fast to even read the logs I want.

            jeremy_kJ Offline
            jeremy_kJ Offline
            jeremy_k
            wrote on last edited by
            #5

            @davidwedel said in qDebug() not working.:

            qt.quick.layouts: QQuickGridLayoutBase::rearrange 0 QQuickRowLayout(0x2456f2f0, id="sensorsWindow", parent=0x2456ecf0, geometry=0,0 0x80)
            qt.quick.layouts: "" QQuickGridLayoutBase::rearrange() QSizeF(0, 80)
            qt.quick.layouts: LEAVE QQuickLayout::ensureLayoutItemsUpdated() QQuickRowLayout(0x2456f2f0)
            qt.quick.layouts: QQuickGridLayoutBase::rearrange 0 QQuickRowLayout(0x2456f2f0, id="sensorsWindow", parent=0x2456ecf0, geometry=0,0 0x80)
            

            I can disable this by setting *.debug=false but then I don't get any qDebug() logs. But now, the console fills up much too fast to even read the logs I want.

            qt.quick.layouts and similar are hierarchical logging categories that can be controlled. Eg *.debug=true; qt.quick.*.debug=false;

            Asking a question about code? http://eel.is/iso-c++/testcase/

            1 Reply Last reply
            4
            • D Offline
              D Offline
              davidwedel
              wrote on last edited by
              #6

              Aha! Thanks @jeremy_k
              The final answer was qt.*.debug=false. I now see the qDebug() warnings, but not all the annoyinbg QT logs.
              So my qtlogging.ini looks like

              qt.*=false
              *.debug=true
              qt.*.debug=false
              qt.qpa.xcb.xcberror.warning=false
              

              Thanks again, both of you!

              1 Reply Last reply
              2
              • D davidwedel

                OK so I got a few things figured out! I did indeed have QT_NO_DEBUG_OUTPUT (set to off I thought) in my CMakeLists.txt. Removed that. Still no joy. Then, went to /usr/share/qt6/qtlogging.ini, and set *.debug=true. Then, the qDebug() logging worked correctly in the basic 4 line program, as well as the QtMessageHandler when added to the 4 line program(by the way, the big project doesn't use QtMessageHandler, though that might change :). But when I go to the big program, the console is completely flooded with all kinds of debug info with all things Qt related. Here's a sample.

                qt.quick.layouts: QQuickGridLayoutBase::rearrange 0 QQuickRowLayout(0x2456f2f0, id="sensorsWindow", parent=0x2456ecf0, geometry=0,0 0x80)
                qt.quick.layouts: "" QQuickGridLayoutBase::rearrange() QSizeF(0, 80)
                qt.quick.layouts: LEAVE QQuickLayout::ensureLayoutItemsUpdated() QQuickRowLayout(0x2456f2f0)
                qt.quick.layouts: QQuickGridLayoutBase::rearrange 0 QQuickRowLayout(0x2456f2f0, id="sensorsWindow", parent=0x2456ecf0, geometry=0,0 0x80)
                

                I can disable this by setting *.debug=false but then I don't get any qDebug() logs. But now, the console fills up much too fast to even read the logs I want.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @davidwedel said in qDebug() not working.:

                Then, went to /usr/share/qt6/qtlogging.ini, and set *.debug=true. Then, the qDebug() logging worked correctly

                Just out of interest/for anyone else reading this. I have the default Qt6 (6.4.2) supplied with Ubuntu 24.04. There is no /usr/share/qt6/qtlogging.ini, nor any qtlogging.ini file anywhere. It outputs qDebug() messages just fine, as do all previous Ubuntu releases, without my having to create this or change anything. In your case, are you saying there was already a qtlogging.ini file with something inside it supplied with your Fedora?

                D 1 Reply Last reply
                0
                • JonBJ JonB

                  @davidwedel said in qDebug() not working.:

                  Then, went to /usr/share/qt6/qtlogging.ini, and set *.debug=true. Then, the qDebug() logging worked correctly

                  Just out of interest/for anyone else reading this. I have the default Qt6 (6.4.2) supplied with Ubuntu 24.04. There is no /usr/share/qt6/qtlogging.ini, nor any qtlogging.ini file anywhere. It outputs qDebug() messages just fine, as do all previous Ubuntu releases, without my having to create this or change anything. In your case, are you saying there was already a qtlogging.ini file with something inside it supplied with your Fedora?

                  D Offline
                  D Offline
                  davidwedel
                  wrote on last edited by
                  #8

                  @JonB said in qDebug() not working.:

                  In your case, are you saying there was already a qtlogging.ini file with something inside it supplied with your Fedora?

                  That's correct. I didn't create it. That also explains why I could never find the qtlogging.ini file on my Mint 21.1 computer

                  JonBJ 1 Reply Last reply
                  0
                  • D davidwedel

                    @JonB said in qDebug() not working.:

                    In your case, are you saying there was already a qtlogging.ini file with something inside it supplied with your Fedora?

                    That's correct. I didn't create it. That also explains why I could never find the qtlogging.ini file on my Mint 21.1 computer

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #9

                    @davidwedel
                    So what was inside it when you found it? My qDebug()s have always worked fine, presumably with that file always empty, maybe somebody put one in for some reason in whichever Mint distribution.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      davidwedel
                      wrote on last edited by
                      #10

                      It had:

                      [Rules]
                      *.debug=false
                      qt.qpa.xcb.xcberror.warning=false
                      

                      Interestingly enough, this file is present on a completely fresh Fedora 40 computer. I booted up a live usb that hadn't had anything Qt related installed, and there it was.

                      JonBJ 1 Reply Last reply
                      1
                      • D davidwedel

                        It had:

                        [Rules]
                        *.debug=false
                        qt.qpa.xcb.xcberror.warning=false
                        

                        Interestingly enough, this file is present on a completely fresh Fedora 40 computer. I booted up a live usb that hadn't had anything Qt related installed, and there it was.

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #11

                        @davidwedel
                        So it looks like maybe someone was playing with Qt and switched default debugging off and that's how it got released with this file in it, even if no Qt! :) Naughty Fedora people!

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved