Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to disable Qt debug messages
QtWS25 Last Chance

How to disable Qt debug messages

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 2.9k 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.
  • B Offline
    B Offline
    bam500
    wrote on last edited by bam500
    #1

    My project was compiled with Qt 5.4.2, I have recently upgraded it by compiling with 5.10.1

    Since it's compiled with 5.10.1 I have a lot of verbose logs such as :

    [2018.08.17 16:49:18:440]D: Generating leave event for  QWidgetWindow(0x28edb550, name="MainWindowWindow")
    [2018.08.17 16:49:20:404]D: Entering  QWidgetWindow(0x28edb550, name="MainWindowWindow")
    [2018.08.17 16:49:20:772]D: WM_MOUSELEAVE for  QWidgetWindow(0x28edb550, name="MainWindowWindow")  previous window under mouse =  QWidgetWindow(0x28edb550, name="MainWindowWindow")  tracked window = QWidgetWindow(0x28edb550, name="MainWindowWindow")
    [2018.08.17 16:49:20:777]D: Generating leave event for  QWidgetWindow(0x28edb550, name="MainWindowWindow")
    

    I have disabled it by writing :

    *.debug = false
    

    in Rules in the qtlogging.ini file.

    It works well but I don't have my own qDebug messages anymore. How can I disable Qt framework messages debug only ?

    JonBJ 1 Reply Last reply
    1
    • B bam500

      My project was compiled with Qt 5.4.2, I have recently upgraded it by compiling with 5.10.1

      Since it's compiled with 5.10.1 I have a lot of verbose logs such as :

      [2018.08.17 16:49:18:440]D: Generating leave event for  QWidgetWindow(0x28edb550, name="MainWindowWindow")
      [2018.08.17 16:49:20:404]D: Entering  QWidgetWindow(0x28edb550, name="MainWindowWindow")
      [2018.08.17 16:49:20:772]D: WM_MOUSELEAVE for  QWidgetWindow(0x28edb550, name="MainWindowWindow")  previous window under mouse =  QWidgetWindow(0x28edb550, name="MainWindowWindow")  tracked window = QWidgetWindow(0x28edb550, name="MainWindowWindow")
      [2018.08.17 16:49:20:777]D: Generating leave event for  QWidgetWindow(0x28edb550, name="MainWindowWindow")
      

      I have disabled it by writing :

      *.debug = false
      

      in Rules in the qtlogging.ini file.

      It works well but I don't have my own qDebug messages anymore. How can I disable Qt framework messages debug only ?

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

      @bam500
      I shall be interested for an alternative answer here, because my understanding is that the internals just use qDebug() like you do, and if you want your own you will get theirs automatically too....

      B 1 Reply Last reply
      1
      • JonBJ JonB

        @bam500
        I shall be interested for an alternative answer here, because my understanding is that the internals just use qDebug() like you do, and if you want your own you will get theirs automatically too....

        B Offline
        B Offline
        bam500
        wrote on last edited by
        #3

        @JonB Mhhh ok, well a workaround would be to change each debug message into warning or info... But it means a lot of changes... Yes an alternative answer would be appreciated!

        1 Reply Last reply
        0
        • J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #4

          there is DEFINES += QT_NO_DEBUG_OUTPUT that you can add to your pro file. It stops any code with qDebug() in it from being executed.

          You can even condition it, so that for example, you get debug output during debug builds, but non in release.

          CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
          

          however, be careful.
          something like

          QFile f(/path/patch/etc),
          qDebug() << f.open();
          

          may very well break your code.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          JonBJ 1 Reply Last reply
          1
          • J.HilkJ J.Hilk

            there is DEFINES += QT_NO_DEBUG_OUTPUT that you can add to your pro file. It stops any code with qDebug() in it from being executed.

            You can even condition it, so that for example, you get debug output during debug builds, but non in release.

            CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
            

            however, be careful.
            something like

            QFile f(/path/patch/etc),
            qDebug() << f.open();
            

            may very well break your code.

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

            @J.Hilk
            I don't understand how this helps? The problem is that there are existing qDebug() statements in internal Qt code, which the user does not want output, and explicit qDebug() in his own code, which he does want output. That's why I wrote my post above.

            J.HilkJ 1 Reply Last reply
            1
            • JonBJ JonB

              @J.Hilk
              I don't understand how this helps? The problem is that there are existing qDebug() statements in internal Qt code, which the user does not want output, and explicit qDebug() in his own code, which he does want output. That's why I wrote my post above.

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @JonB
              oh, you're right, I may have mussunderstood the op.


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              1

              • Login

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