Results 1 to 3 of 3

Thread: How to do logging in a medium size Qt project

  1. #1
    Join Date
    Aug 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to do logging in a medium size Qt project

    i am making a medium size Qt project having around 7 classes and there is a controller class and classes can communicate among themselves too.i want to add error logging feature in it also how can i achieve this.

    i would like to mentio that i used qtinstallmessgehandler which to install logger method and its working fine.my main issue is the ideal location to instantiate the singleton logger class so that it is accessible throughout the project.

    if anybody have any idea please do it asap

    kunal

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to do logging in a medium size Qt project

    Well, you have your message handler, why not use qDebug() << ... ?

    In your message handler you can redirect your debug statements to a file, a socket, a tty, ...

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to do logging in a medium size Qt project

    Quote Originally Posted by kumarkun View Post
    my main issue is the ideal location to instantiate the singleton logger class so that it is accessible throughout the project.
    What pattern do you use? The good thing of singletons is that you can use them everywhere without initiate them. So I don't understand you problem. Have a look at the pattern at our wiki.

Similar Threads

  1. QT Logging class
    By leoalvesmachado in forum Newbie
    Replies: 7
    Last Post: 1st December 2013, 20:30
  2. logging support!!
    By Raajesh in forum Qt Programming
    Replies: 1
    Last Post: 18th June 2008, 19:18
  3. "qconfig -medium" failed
    By avrecorder in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 18th November 2007, 15:16
  4. logging and tracing in Qt
    By Artschi in forum Qt Programming
    Replies: 4
    Last Post: 17th January 2006, 20:10

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.