Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Component.onCompleted with console.log not working, why please?
Forum Updated to NodeBB v4.3 + New Features

Component.onCompleted with console.log not working, why please?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 2 Posters 1.5k 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.
  • M Offline
    M Offline
    Mlibu
    wrote on last edited by Mlibu
    #1

    Hi there. I have a brand new empty Python Qt5 QML project application to which I have added a console.log. Why is my console.log not visible in Application Output? I have seen many examples where they use this technique for debugging and never have a problem.

    import QtQuick 2.15
    import QtQuick.Window 2.15

    Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
    
        Component.onCompleted: {
            console.log("HEREHHERRHEHREHRHRE")
        }
    }
    
    1 Reply Last reply
    1
    • M Offline
      M Offline
      Mlibu
      wrote on last edited by
      #4

      I found the answer to this question. In the build environment I needed to add "QT_FORCE_STDERR_LOGGING=1" to the environment. I'm not sure why STDERR works, when the console.log should be STDOUT but anyway that solved my problem.

      JoeCFDJ 1 Reply Last reply
      1
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #2

        @Mlibu said in Component.onCompleted with console.log not working, why please?:

        import QtQuick 2.15
        import QtQuick.Window 2.15
        Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")

        Component.onCompleted: {
            console.log("HEREHHERRHEHREHRHRE")
        }
        

        }

        I tested it with qmlscene on Linux and log output is ok.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mlibu
          wrote on last edited by
          #3

          I have just noticed that it does come out on the command line but it is not displaying in Qt Creator in Application Output. Might you know why?

          Thanks for the fast response, by the way.

          Does qmlscene work on Windows? I am unable to use the design page in Qt Creator.

          JoeCFDJ 1 Reply Last reply
          0
          • M Offline
            M Offline
            Mlibu
            wrote on last edited by
            #4

            I found the answer to this question. In the build environment I needed to add "QT_FORCE_STDERR_LOGGING=1" to the environment. I'm not sure why STDERR works, when the console.log should be STDOUT but anyway that solved my problem.

            JoeCFDJ 1 Reply Last reply
            1
            • M Mlibu

              I have just noticed that it does come out on the command line but it is not displaying in Qt Creator in Application Output. Might you know why?

              Thanks for the fast response, by the way.

              Does qmlscene work on Windows? I am unable to use the design page in Qt Creator.

              JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by
              #5

              @Mlibu you check where qmake is located. qmlscene should there as well. I do not have Windows on my computer.

              1 Reply Last reply
              0
              • M Mlibu

                I found the answer to this question. In the build environment I needed to add "QT_FORCE_STDERR_LOGGING=1" to the environment. I'm not sure why STDERR works, when the console.log should be STDOUT but anyway that solved my problem.

                JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by JoeCFD
                #6

                @Mlibu said in Component.onCompleted with console.log not working, why please?:

                QT_FORCE_STDERR_LOGGING

                Good for you. I do not have this setting on Linux and am able to see log output in qt creator. Your output is not error message. This setting is kind of odd.

                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