Results 1 to 5 of 5

Thread: Dual Output For qInstallMessageHandler

  1. #1
    Join Date
    Nov 2015
    Posts
    22
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Dual Output For qInstallMessageHandler

    Hello,

    I'm utilizing qInstallMessageHandler with a custom handler to control the format of the message output. This is working correctly. The issue is now that I'm intercepting the data and formatting it, it is no longer making it's way to the Windows debug view as it was prior this. I was using the code provided in the example here.

    I then tried instead to push the data out this way:
    Qt Code:
    1. QTextStream(stdout)
    To copy to clipboard, switch view to plain text mode 

    Passing in the various arguments, which again, works for the IDE but not when running natively and looking to see debug data in the Windows debug view. Is there anyway to have this handler so I can keep messages in the IDE, but also allow for them to be viewed in Windows debug view?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Dual Output For qInstallMessageHandler

    Have you tried writing to stderr?

    Also have a look at this https://woboq.com/blog/nice-debug-output-with-qt.html for a built-in option on customiing the log output.

    Cheers,
    _

  3. #3
    Join Date
    Nov 2015
    Posts
    22
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: Dual Output For qInstallMessageHandler

    Yeah, I tried stderr as that was what they show in the example but it didn't make a difference. I'll have a look at your link.

    Had a look at the link and that is really cool. The only issue is that outside of just altering the look of the message, I need to make certain types conditional and I don't see how you can do that through the pattern QT_MESSAGE_PATTERN.
    Last edited by brixel; 6th May 2016 at 13:01.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Dual Output For qInstallMessageHandler

    After a bit of digging I found this:
    https://code.woboq.org/qt5/qtbase/sr...textRK7QString

    Seems the Windows specific code paths of the default message handler uses some Windows API for logging instead of writing to any IO stream.

    Cheers,
    _

  5. #5
    Join Date
    Nov 2015
    Posts
    22
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: Dual Output For qInstallMessageHandler

    Ah - Yes, OutputDebugString. I'll have to try and figure out how to use that. Thanks for finding this.

Similar Threads

  1. Replies: 5
    Last Post: 30th June 2017, 13:43
  2. binding to qInstallMessageHandler
    By TorAn in forum Qt Programming
    Replies: 4
    Last Post: 21st December 2013, 16:51
  3. Why qInstallMessageHandler not run on console app?
    By patrik08 in forum Qt Programming
    Replies: 0
    Last Post: 20th November 2013, 11:37
  4. Dual frame buffers /dev/fb0 and /dev/fb1
    By ghassett in forum Qt Programming
    Replies: 0
    Last Post: 28th May 2009, 18:57
  5. Dual TCP/IP Client/Server
    By jimroos in forum Qt Programming
    Replies: 1
    Last Post: 29th June 2007, 21:58

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.