Results 1 to 4 of 4

Thread: Writing To Windows Event Viewer

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

    Default Writing To Windows Event Viewer

    Hello,

    Is it possible to write logs to the Windows Event Viewer from Qt? If so, can someone provide a simple example to get me started? Thanks.

  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: Writing To Windows Event Viewer

    Assuming Windows has a C or C++ API to write to that, then just calling that should be suffiicient.

    Cheers,
    _

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

    Default Re: Writing To Windows Event Viewer

    Thanks. I ended up just using the QMessageLogger as this does output to the standard debugger for Windows and that will suffice. One additional question though. The QMessageLogContext has "function" as a property which is nice to include, but I was wondering, is there was a way to also derive the arguments that were passed into the function when it was called?

  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: Writing To Windows Event Viewer

    No, you'll have to log arguments manually.

    The arguments could be any type and require type specific handling to get something suitable for logging.

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    brixel (4th May 2016)

Similar Threads

  1. Problem with event handling of multiple windows
    By rakefet in forum Qt Programming
    Replies: 2
    Last Post: 11th April 2014, 21:40
  2. Replies: 2
    Last Post: 9th August 2011, 08:37
  3. Replies: 2
    Last Post: 15th February 2011, 06:16
  4. Event propagation-Windows key special case
    By hanumanth in forum Qt Programming
    Replies: 0
    Last Post: 16th April 2010, 15:46
  5. Issues writing a simple image viewer class
    By ultim8 in forum Qt Programming
    Replies: 5
    Last Post: 27th March 2009, 13:50

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.