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 qDebug ?
QtWS25 Last Chance

How to disable qDebug ?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 1.4k 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    I am looking for suggestions on how / where to disable ALL qDebug outputs to "Application Output" view during "Run" .

    I found this in another forum - but changing the QT_LOGGING_RULES does not compile when placed in header file. ( sorry the new error message posted BEFORE build does not copy something about C++ requires type specifier )

    I did try to add same into main x.pro file in my "subdirs" project , it complied but did not stop qDebug from executing.

    #ifndef PROJECT_COMMON_INCLUDE_H
    #define PROJECT_COMMON_INCLUDE_H
    #include <QLoggingCategory>
    QT_LOGGING_RULES="*.debug=false"; thows C++ syntax error
    #endif // PROJECT_COMMON_INCLUDE_H

    J.HilkJ 1 Reply Last reply
    0
    • A Anonymous_Banned275

      I am looking for suggestions on how / where to disable ALL qDebug outputs to "Application Output" view during "Run" .

      I found this in another forum - but changing the QT_LOGGING_RULES does not compile when placed in header file. ( sorry the new error message posted BEFORE build does not copy something about C++ requires type specifier )

      I did try to add same into main x.pro file in my "subdirs" project , it complied but did not stop qDebug from executing.

      #ifndef PROJECT_COMMON_INCLUDE_H
      #define PROJECT_COMMON_INCLUDE_H
      #include <QLoggingCategory>
      QT_LOGGING_RULES="*.debug=false"; thows C++ syntax error
      #endif // PROJECT_COMMON_INCLUDE_H

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

      @AnneRanch
      in your pro file add DEFINES += QT_NO_DEBUG_OUTPUT

      disables qDebug() output


      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.

      A 1 Reply Last reply
      3
      • Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @AnneRanch said in How to disable qDebug ?:

        QT_LOGGING_RULES="*.debug=false"; thows C++ syntax error

        How do you expect that this does compile at all?

        QT_LOGGING_RULES is an environment variable.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        2
        • A Anonymous_Banned275

          I am looking for suggestions on how / where to disable ALL qDebug outputs to "Application Output" view during "Run" .

          I found this in another forum - but changing the QT_LOGGING_RULES does not compile when placed in header file. ( sorry the new error message posted BEFORE build does not copy something about C++ requires type specifier )

          I did try to add same into main x.pro file in my "subdirs" project , it complied but did not stop qDebug from executing.

          #ifndef PROJECT_COMMON_INCLUDE_H
          #define PROJECT_COMMON_INCLUDE_H
          #include <QLoggingCategory>
          QT_LOGGING_RULES="*.debug=false"; thows C++ syntax error
          #endif // PROJECT_COMMON_INCLUDE_H

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

          @AnneRanch
          in your pro file add DEFINES += QT_NO_DEBUG_OUTPUT

          disables qDebug() output


          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.

          A 1 Reply Last reply
          3
          • J.HilkJ J.Hilk

            @AnneRanch
            in your pro file add DEFINES += QT_NO_DEBUG_OUTPUT

            disables qDebug() output

            A Offline
            A Offline
            Anonymous_Banned275
            wrote on last edited by
            #4

            @J-Hilk Thanks Purfect , KISS and works .Just in case anybody is interested I found this after your post.
            https://forum.qt.io/topic/73314/why-does-this-defined-qt_no_debug_output-not-supress-the-qdebug

            1 Reply Last reply
            1
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #5

              Hi,

              Note that Qt categorized logging is a different beast that uses qCDebug and friends. They are the one you can use QT_LOGGING_RULES with.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              A 1 Reply Last reply
              0
              • SGaistS SGaist

                Hi,

                Note that Qt categorized logging is a different beast that uses qCDebug and friends. They are the one you can use QT_LOGGING_RULES with.

                A Offline
                A Offline
                Anonymous_Banned275
                wrote on last edited by
                #6

                @SGaist said in How to disable qDebug ?:

                Hi,

                Note that Qt categorized logging is a different beast that uses qCDebug and friends. They are the one you can use QT_LOGGING_RULES with.

                The article I read first did not make it clear if it works with module / class or make.

                I am also looking at implementing
                qSetMessagePattern(testPattern); // const QString &pattern)

                which is ever harder to figure out .

                And it also kills qDebug....

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  From the QLoggingCategory documentation:

                  Logging rules can also be specified in a QT_LOGGING_RULES environment variable; multiple rules can also be separated by semicolons:
                  

                  It's an environment variable.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  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