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: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

Console Printing is not showing ,while i am debugging

[ Edited ]

Hi,

 

While debugging an application, i am not able see Qdebug statements,as shown in the picture

 WhileDebug.jpg

Similarly while running the application ,i am able see debug statements in the console

Whilerunning.jpg

 

 

 

 

Regards

 

Rakesh shankar.P

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: Console Printing is not showing ,while i am debugging

The pictures didn't come through Smiley Sad

 

When debugging, sometimes the topmost console is not the one with the qDebug() messages.  In Momentics console window, look for an icon that looks like a computer screen.  Select other consoles.

 

Hopefully this is your issue!

 

Stuart

Developer
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

Re: Console Printing is not showing ,while i am debugging

Hi stuart,

 

 

I am looking at the console window only,Plz loook at the below picture

 

Whilerunning1.jpg

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: Console Printing is not showing ,while i am debugging

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: Console Printing is not showing ,while i am debugging

Did this answer your question?

If so, please accept a solution.

If not, can you provide any more details that might guide us to how your situation is different?

 

Stuart

Developer
Posts: 91
Registered: ‎09-25-2012
My Device: bb10 alpha
My Carrier: free

Re: Console Printing is not showing ,while i am debugging

With the SDK 10.0.09 beta 3 : 

 

QDebug() doesn't output the string in the console... ( I hope this is a bug and not a feature...)

So all input can be retrieve from the phone ssh console : 

1- From the IDE , click windows ->show View -> other 

2- Find Target Navigator

3- Click on your device and Launch SSH session

4- From the console , type : slog2info -w | grep  qt-msg 

5- Keep this console opened and start your application to see live log message

a lover of Qt
BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: Console Printing is not showing ,while i am debugging

It's a feature, not a bug Smiley Wink

 

Actually, the story is: qDebug() will not output to stderr anymore, because this introduces inefficiencies.  Instead it is using the internal slogger2 infrastructure, which as indicated can be viewed using the command: slog2info -w.

The IDE is still looking for logs in the old location, but will be fixed in a future IDE release.

 

If you REALLY want to use stderr for debugging, you can define a custom logging function like so:

static void log_to_stderr(QtMsgType msgType, const char *msg)
{
    (void)msgType;  // go away, warning!
    fprintf(stderr, "%s\n", msg);
}

 And then enable it in your initialization code like so:

    qInstallMsgHandler(log_to_stderr);

 

I would not suggest shipping final code like this due to the performance penalties associated with stderr.. perhaps only install the msg handler if you have an #ifdef DEBUGGING or similar.

 

Cheers,

Sean

Developer
Posts: 91
Registered: ‎09-25-2012
My Device: bb10 alpha
My Carrier: free

Re: Console Printing is not showing ,while i am debugging

Okay thanks for you reply ! 

 

So the good way to print a message in the console is to use : 

 

fprintf(stderr, "%s\n", "Here it works !!");

a lover of Qt
BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: Console Printing is not showing ,while i am debugging

I'm pretty sure stdout is also picked up by the logs, and may be a bit more efficient than stderr:

printf("%s\n", msg);
fflush(stdout);