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. [Solved] How to show Qt debug messages outside the debugger
Forum Updated to NodeBB v4.3 + New Features

[Solved] How to show Qt debug messages outside the debugger

Scheduled Pinned Locked Moved General and Desktop
22 Posts 11 Posters 46.6k Views 1 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.
  • D Offline
    D Offline
    d.oberkofler
    wrote on last edited by
    #1

    The Qt framework shows a lot of useful debug messages (signals not properly connected as a very prominent example) at runtime but more generally this applies to all debug messages build into an application.
    Unfortunately (at least unter OSX and Windows) the messages are only visible when running the application in a debugger.
    Is there a strait-forward way to see those message outside a debugger?

    1 Reply Last reply
    0
    • I Offline
      I Offline
      Immii
      wrote on last edited by
      #2

      when you say out side of debugger, Do you mean on Terminal/console? If yes then you do get those message on console. I do not remember 100% but there is some macro which gives you the warnings. May be other members give some more info, Or you may like to ask this on qt-interest mailing list as I personely think there you have much more members since years to help.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        baysmith
        wrote on last edited by
        #3

        Add this to your qmake .pro file
        @
        CONFIG += console
        @

        Nokia Certified Qt Specialist.

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qtrahul
          wrote on last edited by
          #4

          What actually want to do.
          Do you want to transfer those msgs outside that console debugger ?

          Suppose ,I am using Qt creator, then the msgs which are created only in the debug environment, I have not seen it.

          Because user does not have the access to the debug handling property.

          regards,

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kamalakshantv
            wrote on last edited by
            #5

            Make changes to your .pro file as bradley has mentioned.

            Also you can explore more options

            @CONFIG += qt warn_on release rtti exceptions @

            1 Reply Last reply
            0
            • D Offline
              D Offline
              d.oberkofler
              wrote on last edited by
              #6

              [quote author="Bradley" date="1293091435"]Add this to your qmake .pro file
              @
              CONFIG += console
              @
              [/quote]

              I've just tried to add this CONFIG option to a sample project but cannot see any changes under OSX. I've added a simple
              @
              qDebug() << "test";
              @
              that is shown in the debugger and QtCreator but cannot be seen when running my sample using open from by shell.

              Could you please give me some more information on:

              • What this configuration is supposed to do and/or where to find the documentation?
              • To what this option in qmake translates in a simple makefile?

              Thank you!

              1 Reply Last reply
              0
              • D Offline
                D Offline
                d.oberkofler
                wrote on last edited by
                #7

                [quote author="qtrahul" date="1293091619"]What actually want to do.
                Do you want to transfer those msgs outside that console debugger ?

                Suppose ,I am using Qt creator, then the msgs which are created only in the debug environment, I have not seen it.

                Because user does not have the access to the debug handling property.

                regards,[/quote]

                What I'm actually investigating is how to make this (debug output) information available to others then the actual developer. In my case this would typically be someone from Q&A doing alpha and beta tests or end users doing beta testing using debug builds.

                The debug messages are often extremely useful to track down problems while testing and it would somehow be nice to have a little window aside of the actual application that shows the debug messages as they show up. This can for sure be implemented individually using a customized logging but I was just wondering what the "standard" functionality of the Qt Framework offers.

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kamalakshantv
                  wrote on last edited by
                  #8

                  Seems in that case you will have to log it to a file.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    giesbert
                    wrote on last edited by
                    #9

                    You can install message handlers in Qt, to catch the debug messages and do with them, what you need. I know, there is a possibility, but I'm not 100% sure, how.

                    Nokia Certified Qt Specialist.
                    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      giesbert
                      wrote on last edited by
                      #10

                      I looked a bit for information about this topic:
                      "Here som general things about debugging (also to Mac)":http://doc.qt.nokia.com/4.7/debug.html

                      bq. The Qt implementation of these functions prints the text to the stderr output under Unix/X11 and Mac OS X. With Windows, if it is a console application, the text is sent to console; otherwise, it is sent to the debugger. You can take over these functions by installing a message handler using qInstallMsgHandler().

                      So it also shows a way you can go to use "custom message handlers":http://doc.qt.nokia.com/4.7/qtglobal.html#qInstallMsgHandler

                      Nokia Certified Qt Specialist.
                      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        goetz
                        wrote on last edited by
                        #11

                        On Mac OS X the debug output goes to the system logger. You can read it with the Console Application (Usually in /Applications/Utilities/Console.app).

                        For your own logging facilities "qInstallMsgHandler()":http://doc.qt.nokia.com/latest/qtglobal.html#qInstallMsgHandler is your friend (that's the solution Gerolf mentioned).

                        I once wrote a small GUI that collects the qXXX() messages. I can put it in the wiki on request.

                        http://www.catb.org/~esr/faqs/smart-questions.html

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          kamalakshantv
                          wrote on last edited by
                          #12

                          You can get some help using qInstallMsgHandler() from "this":http://lists.trolltech.com/qt-interest/2006-05/msg00602.html thread too.

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            andre
                            wrote on last edited by
                            #13

                            QxtLogger can install itself the hander for Qt's debug messages as well, and you can use several outputs for your logging info. StdErr/StdOut of course, but also files in different formats.

                            The qt += console suggestion given earlier only works on windows.

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              d.oberkofler
                              wrote on last edited by
                              #14

                              [quote author="Volker" date="1293097794"]On Mac OS X the debug output goes to the system logger. You can read it with the Console Application (Usually in /Applications/Utilities/Console.app).

                              For your own logging facilities "qInstallMsgHandler()":http://doc.qt.nokia.com/latest/qtglobal.html#qInstallMsgHandler is your friend (that's the solution Gerolf mentioned).

                              I once wrote a small GUI that collects the qXXX() messages. I can put it in the wiki on request.[/quote]

                              I think it would be great if you could make your "small GUI that collects the qXXX() messages" available to everyone.

                              1 Reply Last reply
                              0
                              • V Offline
                                V Offline
                                vcsala
                                wrote on last edited by
                                #15

                                @Volker, that would be really nice of you.

                                1 Reply Last reply
                                0
                                • K Offline
                                  K Offline
                                  kamalakshantv
                                  wrote on last edited by
                                  #16

                                  [quote author="Volker" date="1293097794"]On Mac OS X the debug output goes to the system logger. You can read it with the Console Application (Usually in /Applications/Utilities/Console.app).

                                  For your own logging facilities "qInstallMsgHandler()":http://doc.qt.nokia.com/latest/qtglobal.html#qInstallMsgHandler is your friend (that's the solution Gerolf mentioned).

                                  I once wrote a small GUI that collects the qXXX() messages. I can put it in the wiki on request.[/quote]

                                  Yes, everyone would like such a handy tool.

                                  1 Reply Last reply
                                  0
                                  • G Offline
                                    G Offline
                                    giesbert
                                    wrote on last edited by
                                    #17

                                    Request :-))

                                    Nokia Certified Qt Specialist.
                                    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                                    1 Reply Last reply
                                    0
                                    • G Offline
                                      G Offline
                                      goetz
                                      wrote on last edited by
                                      #18

                                      I've added a "wiki page":http://developer.qt.nokia.com/wiki/Browser_for_QDebug_output with the source code of the QDebug Log Output Browser.

                                      I hope it is useful for somebody and of course feel free to ask, if you have questions.

                                      http://www.catb.org/~esr/faqs/smart-questions.html

                                      1 Reply Last reply
                                      0
                                      • A Offline
                                        A Offline
                                        ashwindas
                                        wrote on last edited by
                                        #19

                                        Thanks Volker, I was also looking for something similar :)

                                        1 Reply Last reply
                                        0
                                        • U Offline
                                          U Offline
                                          ucomesdag
                                          wrote on last edited by
                                          #20

                                          [quote author="Volker" date="1294011522"]I've added a "wiki page":http://developer.qt.nokia.com/wiki/Browser_for_QDebug_output with the source code of the QDebug Log Output Browser.[/quote]

                                          Thanks Volker, fiddling with it at the moment... :-)

                                          Write “Qt”, not “QT” (QuickTime).

                                          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