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. is there any way to switch off qDebug() messages from command line ?
Forum Updated to NodeBB v4.3 + New Features

is there any way to switch off qDebug() messages from command line ?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 505 Views 1 Watching
  • 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.
  • R Offline
    R Offline
    RahibeMeryem
    wrote on last edited by
    #1

    Hi,

    What is the best way to switch on / off (print shell or not) qDebug() messages ? can we do this as and argument when we starting to application ?

    Best

    KroMignonK 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      Im not sure there is a commandline as i have only seen compile time switch.
      However, you can use
      https://doc.qt.io/qt-5/qtglobal.html#qInstallMessageHandler
      and add a variable to control if you print it or not.

      1 Reply Last reply
      4
      • R RahibeMeryem

        Hi,

        What is the best way to switch on / off (print shell or not) qDebug() messages ? can we do this as and argument when we starting to application ?

        Best

        KroMignonK Offline
        KroMignonK Offline
        KroMignon
        wrote on last edited by KroMignon
        #3

        @RahibeMeryem You can switch off all debug string with enviroment variable QT_LOGGING_RULES .

        QT_LOGGING_RULES="*.debug=false;"
        

        Then start your application.
        You can do this in batch / shell script before starting your application. Or in application with adding:

        qputenv("QT_LOGGING_RULES", "*.debug=false;");
        

        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

        1 Reply Last reply
        7
        • R Offline
          R Offline
          RahibeMeryem
          wrote on last edited by
          #4

          @KroMignon thanks a lot working like a charm..

          Best

          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