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?

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

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 2 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.
  • M Offline
    M Offline
    Mlibu
    wrote on 27 Jul 2022, 16:13 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 27 Jul 2022, 16:58 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.

      J 1 Reply Last reply 27 Jul 2022, 17:15
      1
      • J Offline
        J Offline
        JoeCFD
        wrote on 27 Jul 2022, 16:17 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 27 Jul 2022, 16:23 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.

          J 1 Reply Last reply 27 Jul 2022, 17:04
          0
          • M Offline
            M Offline
            Mlibu
            wrote on 27 Jul 2022, 16:58 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.

            J 1 Reply Last reply 27 Jul 2022, 17:15
            1
            • M Mlibu
              27 Jul 2022, 16:23

              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.

              J Offline
              J Offline
              JoeCFD
              wrote on 27 Jul 2022, 17:04 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
                27 Jul 2022, 16:58

                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.

                J Offline
                J Offline
                JoeCFD
                wrote on 27 Jul 2022, 17:15 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

                4/6

                27 Jul 2022, 16:58

                • Login

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