Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 34
Registered: ‎02-06-2013
My Device: BlackBerry Z10
My Carrier: AT & T

qDebug output is not visible in console

I am new to blackberry development. After installing Momentics IDE, I have created my sample app using 10.2 SDK. App runs fine but it doesn't display any debug message in console when I use qDebug() in C++ file. I looked into everything even tried using qInstallMsgHandler suggested in few articles but no luck. I am not sure what else to look for. I am completely bogged down by silly issue. Can anyone else suggest how to resolve this?

 

#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/data/DataSource>
#include <QLocale>
#include <QTranslator>
#include "applicationui.hpp"
#include <QDebug>
#include <Qt/qdeclarativedebug.h>

 

using namespace bb::cascades;

 

Q_DECL_EXPORT int main(int argc, char **argv)
{
  qDebug() << "Welcome to My app- 1" << endl;

  Application app(argc, argv);

 

  // Create the Application UI object, this is where the main.qml file
  // is loaded and the application scene is set.
  new ApplicationUI(&app);

 

 qDebug() << "Welcome to My app - 2" << endl;

 

 // Enter the application main event loop.
 return Application::exec();
}

 

http://developer.blackberry.com/native/documentation/cascades/dev/tools/debugging.html 

Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: qDebug output is not visible in console

Hi atmanpathak

 

your code looks fine and should display the debug messages. I'm also having trouble sometimes that the debugger doesn't want to show my debug messages, so normally I close Momentics and restart it. If that didn't work, I restart my device. And if that also didn't do the trick, I restart my computer (it's some kind of syncing problem)

 

To be sure with your code, you can hover with your mouse over 'qDebug()'. It should say Q_CORE_EXPORT_INLINE QDebug qDebug() { return QDebug(QtDebugMsg); }

 

 

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: qDebug output is not visible in console

maybe this helps:
http://supportforums.blackberry.com/t5/Native-Development-Knowledge/Debug-on-the-device-with-console...

otherwise you can also use qInstallMsgHandler to install a message handler that prints the messages using fprintf (for example)
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 34
Registered: ‎02-06-2013
My Device: BlackBerry Z10
My Carrier: AT & T

Re: qDebug output is not visible in console

Mention article is related BlackBerry® 10 Native SDK 10.0.9 Beta 3 and I am currently using 10.2 SDK. I read about similar issues in earlier version which claim to be resolved in latest release. I even tried using qInstallMsgHandler option but no luck.

Retired
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: qDebug output is not visible in console

How are you running the app? What happens if you create a simple hello world app and add some debug output to it?

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker