Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Logging filter for QRemoteObjects
Qt 6.11 is out! See what's new in the release blog

Logging filter for QRemoteObjects

Scheduled Pinned Locked Moved Unsolved Qt for Python
3 Posts 2 Posters 645 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
    dodgyrabbit
    wrote on last edited by
    #1

    I would like to suppress the following log message:

    "Dynamic metaobject is not assigned"

    However, using QLoggingCategory.setFilterRules("") I can't seem to find a way to disable it.

    It almost looks like an uncategorized log. I can stop it by adding QLoggingCategory.setFilterRules("*")

    Any advice would be appreciated

    D 1 Reply Last reply
    0
    • D dodgyrabbit

      I would like to suppress the following log message:

      "Dynamic metaobject is not assigned"

      However, using QLoggingCategory.setFilterRules("") I can't seem to find a way to disable it.

      It almost looks like an uncategorized log. I can stop it by adding QLoggingCategory.setFilterRules("*")

      Any advice would be appreciated

      D Offline
      D Offline
      dodgyrabbit
      wrote on last edited by
      #2

      I had a look in the source code, this is what it does:

          if (!impl->m_metaObject) {
              qWarning() << "Dynamic metaobject is not assigned, returning generic Replica metaObject.";
              qWarning() << "This may cause issues if used for more than checking the Replica state.";
              return QRemoteObjectReplica::metaObject();
          }
      

      Since this is a generic warning, the way to suppress is:

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

      Not the greatest I guess, since it may suppress other warnings. But in PySide, the object definitions are not compiled (and I don't believe there is a way to do it), so you always get this warning.

      JonBJ 1 Reply Last reply
      0
      • D dodgyrabbit

        I had a look in the source code, this is what it does:

            if (!impl->m_metaObject) {
                qWarning() << "Dynamic metaobject is not assigned, returning generic Replica metaObject.";
                qWarning() << "This may cause issues if used for more than checking the Replica state.";
                return QRemoteObjectReplica::metaObject();
            }
        

        Since this is a generic warning, the way to suppress is:

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

        Not the greatest I guess, since it may suppress other warnings. But in PySide, the object definitions are not compiled (and I don't believe there is a way to do it), so you always get this warning.

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

        @dodgyrabbit
        Yes, suppressing all warning messages for the sake of one particular one is not nice.

        Forget about QLoggingCategory, it's too "coarse". You need something where you can see the message text. All Qt messages, including qWarning() etc., send their messages for output via QtMessageHandler qInstallMessageHandler(QtMessageHandler handler) which you can intercept. Install your own handler as shown. Calling that returns a pointer to the previous message handler. Discard your undesired message by looking at const QString &msg, call the previous handler for anything else.

        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