×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    7

    How to capture qDebug() messages on the phone?

    Where is the log file from qDebug(), or how can I enable it on s60?


    Pawel

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: How to capture qDebug() messages on the phone?

    Hi,

    You can control qDebug messages by installing a Qt message handler

    http://doc.trolltech.com/4.5/qtgloba...tallMsgHandler

    Code:
    void debugOutput(QtMsgType type, const char *msg)
     {
         switch (type) 
         {
             case QtDebugMsg:
    			
    	 QFile file("C:\\Data\\debug.txt");
    		    
    	 if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
    	      return;
    		    
    	 QTextStream out(&file);
    	 out << "Debug: ";
    	 out << msg;
    	 break;
    	 ....
    	 //the rest of the message types
         }
     }
    
    
    int main(int argc, char *argv[])
    {
    	qInstallMsgHandler(debugOutput);
            .....
    }

  3. #3
    Regular Contributor
    Join Date
    Mar 2009
    Posts
    430

    Re: How to capture qDebug() messages on the phone?

    You can also forward them to be shown in message boxes on the phone by adding QErrorMessage::qtHandler() to your main.cpp. Only do this if you use some qDebug-statements and not have qdebug in every second line of code because you will end up dissmissing a lot of popups.

Similar Threads

  1. Update PC Messages, connected to Phone
    By azharuddin in forum General Messaging
    Replies: 0
    Last Post: 2006-12-21, 05:53
  2. Replies: 0
    Last Post: 2003-08-26, 08:23
  3. Moving SMS messages from old to new phone
    By constable in forum General Development Questions
    Replies: 3
    Last Post: 2003-04-15, 15:23
  4. Replies: 1
    Last Post: 2002-07-16, 06:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×