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. Changing debug log level
Forum Update on Monday, May 27th 2025

Changing debug log level

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 6.6k 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.
  • P Offline
    P Offline
    pderocco
    wrote on 6 Jan 2019, 07:16 last edited by
    #1

    Is there any way, preferably from QML, to change the debug log level to suppress harmless warnings? I've got some QML GridLayout stuff that complains about cells already being taken, and they're cluttering up the log when I'm trying to use the log for my own debugging.

    (FYI, GridLayout objects have a particular limitation when dealing with items that span multiple cells, which I was only able to work around by overlapping them with dummy items. So I can't accomplish the formatting I need without provoking these harmless but annoying warnings.)

    K 1 Reply Last reply 7 Jan 2019, 07:44
    0
    • S sierdzio
      7 Jan 2019, 07:13

      See logging category docs.

      P Offline
      P Offline
      pderocco
      wrote on 7 Jan 2019, 07:57 last edited by pderocco 1 Jul 2019, 07:59
      #4

      @sierdzio Thanks. Using this in main.cpp:

      QLoggingCategory::setFilterRules("*.warning=false");

      suppresses the warnings, but allows my console.log stuff to come through. I'd like to be more specific, but it appears that qgridlayoutengine.cpp uses QWarning(), which implies the "default" category, so even if I change the wildcard to "default", it's probably still going to filter out most warnings I might get in the future. I wish there was a way to install a regex filter on the log output.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sierdzio
        Moderators
        wrote on 7 Jan 2019, 07:13 last edited by
        #2

        See logging category docs.

        (Z(:^

        P 1 Reply Last reply 7 Jan 2019, 07:57
        5
        • P pderocco
          6 Jan 2019, 07:16

          Is there any way, preferably from QML, to change the debug log level to suppress harmless warnings? I've got some QML GridLayout stuff that complains about cells already being taken, and they're cluttering up the log when I'm trying to use the log for my own debugging.

          (FYI, GridLayout objects have a particular limitation when dealing with items that span multiple cells, which I was only able to work around by overlapping them with dummy items. So I can't accomplish the formatting I need without provoking these harmless but annoying warnings.)

          K Offline
          K Offline
          KazuoAsano
          Qt Champions 2018
          wrote on 7 Jan 2019, 07:44 last edited by
          #3

          @pderocco ,

          I think that only QML can't stop warning from library.
          In mixed C ++ and QML project case, it may be stop by adding QT_NO_WARNING_OUTPUT at CONFIG.
          http://doc.qt.io/qt-5/debug.html#warning-and-debugging-messages

          and additional information, I use original log output at "LoggingCategory QML Type" in QML.
          https://doc.qt.io/qt-5/qml-qtqml-loggingcategory.html

          1 Reply Last reply
          1
          • S sierdzio
            7 Jan 2019, 07:13

            See logging category docs.

            P Offline
            P Offline
            pderocco
            wrote on 7 Jan 2019, 07:57 last edited by pderocco 1 Jul 2019, 07:59
            #4

            @sierdzio Thanks. Using this in main.cpp:

            QLoggingCategory::setFilterRules("*.warning=false");

            suppresses the warnings, but allows my console.log stuff to come through. I'd like to be more specific, but it appears that qgridlayoutengine.cpp uses QWarning(), which implies the "default" category, so even if I change the wildcard to "default", it's probably still going to filter out most warnings I might get in the future. I wish there was a way to install a regex filter on the log output.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sierdzio
              Moderators
              wrote on 7 Jan 2019, 08:07 last edited by
              #5

              You can install your own filter (see next section under my link), but that will be cumbersome.

              Or you can patch your Qt sources and insert a logging category in that file, then filter it out.

              It would also be good to fix this upstream - feel invited to open a bug report for last of category in layout engine.

              (Z(:^

              1 Reply Last reply
              1

              1/5

              6 Jan 2019, 07:16

              • Login

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