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. Message handler, fflush(stderr) doesn't work
Qt 6.11 is out! See what's new in the release blog

Message handler, fflush(stderr) doesn't work

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 2 Posters 3.1k Views 2 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.
  • SPlattenS SPlatten

    @mrjj, sorry, my fault, it won't do anything because although the output appears eventually in the Application Output, the function that is called to do the output is not qDebug(). The output is produced in Script using "console.info", which although it appears in the Application Output obviously doesn't go via the same handlers that the qDebug() does.

    mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #6

    @SPlatten
    ahh that way :)
    Nope i would assume its something else since its on JS side.

    SPlattenS 1 Reply Last reply
    0
    • mrjjM mrjj

      @SPlatten
      ahh that way :)
      Nope i would assume its something else since its on JS side.

      SPlattenS Offline
      SPlattenS Offline
      SPlatten
      wrote on last edited by
      #7

      @mrjj One possible solution could be to redirect stdout to stderr ?

      mrjjM 1 Reply Last reply
      0
      • SPlattenS SPlatten

        @mrjj One possible solution could be to redirect stdout to stderr ?

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #8

        @SPlatten
        Im not sure what is being used internally.
        https://doc.qt.io/qt-5/qtquick-debugging.html
        sounds like it is using qDebug. internally.
        but is this console.log in QML or pure JS ?

        SPlattenS 1 Reply Last reply
        0
        • mrjjM mrjj

          @SPlatten
          Im not sure what is being used internally.
          https://doc.qt.io/qt-5/qtquick-debugging.html
          sounds like it is using qDebug. internally.
          but is this console.log in QML or pure JS ?

          SPlattenS Offline
          SPlattenS Offline
          SPlatten
          wrote on last edited by
          #9

          @mrjj, console.info

          mrjjM 1 Reply Last reply
          0
          • SPlattenS SPlatten

            @mrjj, console.info

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #10

            @SPlatten
            So yes to QML?

            SPlattenS 1 Reply Last reply
            0
            • mrjjM mrjj

              @SPlatten
              So yes to QML?

              SPlattenS Offline
              SPlattenS Offline
              SPlatten
              wrote on last edited by
              #11

              @mrjj , sorry, this application is only JS.

              mrjjM 1 Reply Last reply
              0
              • SPlattenS SPlatten

                @mrjj , sorry, this application is only JS.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #12

                @SPlatten
                Ok then i understand it.
                Im not sure how to flush its buffers then.
                JS dont have a flush on its own or anything?

                SPlattenS 1 Reply Last reply
                0
                • mrjjM mrjj

                  @SPlatten
                  Ok then i understand it.
                  Im not sure how to flush its buffers then.
                  JS dont have a flush on its own or anything?

                  SPlattenS Offline
                  SPlattenS Offline
                  SPlatten
                  wrote on last edited by
                  #13

                  @mrjj , found this, https://stackoverflow.com/questions/28412477/how-to-flush-console-log-output-on-windows

                  Couldn't I just flush stdout too?

                  mrjjM 1 Reply Last reply
                  0
                  • SPlattenS SPlatten

                    @mrjj , found this, https://stackoverflow.com/questions/28412477/how-to-flush-console-log-output-on-windows

                    Couldn't I just flush stdout too?

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #14

                    @SPlatten
                    Good found.
                    Yes seem so.
                    I would try it at once as no harm from it.

                    SPlattenS 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @SPlatten
                      Good found.
                      Yes seem so.
                      I would try it at once as no harm from it.

                      SPlattenS Offline
                      SPlattenS Offline
                      SPlatten
                      wrote on last edited by
                      #15

                      @mrjj , in the end I wrote a routine in the C++ that is invokable in the JavaScript, then just replaced all calls to console.info with my own routine, this works well.

                      1 Reply Last reply
                      1
                      • SPlattenS Offline
                        SPlattenS Offline
                        SPlatten
                        wrote on last edited by
                        #16

                        @mrjj , ok, now I'm really confused, after adding my API routine, I can now see using the debugger than messages from JavaScript via the API call and C++ make it into the message handler, I' ve stepped through and the output string contains correct content, but for some reason I do not see the output from the JavaScript API call in the Application Output.

                        SPlattenS 1 Reply Last reply
                        0
                        • SPlattenS SPlatten

                          @mrjj , ok, now I'm really confused, after adding my API routine, I can now see using the debugger than messages from JavaScript via the API call and C++ make it into the message handler, I' ve stepped through and the output string contains correct content, but for some reason I do not see the output from the JavaScript API call in the Application Output.

                          SPlattenS Offline
                          SPlattenS Offline
                          SPlatten
                          wrote on last edited by
                          #17

                          @SPlatten, In the message handler, I'm going to push every entry onto a stack then have a separate thread that services the stack popping off the first from the stack.

                          mrjjM 1 Reply Last reply
                          0
                          • SPlattenS SPlatten

                            @SPlatten, In the message handler, I'm going to push every entry onto a stack then have a separate thread that services the stack popping off the first from the stack.

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by
                            #18

                            @SPlatten
                            Ok, im not sure what causes this but its worth a shot.

                            1 Reply Last reply
                            0
                            • SPlattenS Offline
                              SPlattenS Offline
                              SPlatten
                              wrote on last edited by
                              #19
                              This post is deleted!
                              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