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: 139
Registered: ‎05-24-2011
My Device: Z30 running 10.2 and Playbook 4GLTE running OS2.1
My Carrier: rogers

debugging the headless part...?

hi gang,

 

just getting started with making my app headless.

 

I started from scratch and followed all the instructions on the Cascades documentation page on setting up a headless project.  Took a bit, but using the 'headless service' sample app, i think i was able to get my app going.  when i launch the ui part, i see the headless part start up in the background and stays running even after the ui part shuts down.  great.

 

however, i'm having some trouble getting the headless part to send qDebug() messages to the console.  I have a custom Message Handler and it's registered with qInstallMessageHandleer(), but qDebug messages don't appear in the console.  they do appear from the ui part, no problem.

 

am i missing something?  is it possible to debug the headless part in any way?

 

thx,

 

J

bron: a cron-like scheduler for BlackBerry 10
http://apps.oddelement.com
Highlighted
Retired
Posts: 249
Registered: ‎07-14-2008
My Device: Not Specified

Re: debugging the headless part...?

I know if you do not have a custom handler, all qdebugs definitely show up in the console just like the UI.. Where are you printing the qdebug()s in your custom message handler? 

 

The other way to see the logs is to write them to a file from your message handler and then cat the file in the terminal..

 

Shadid

Developer
Posts: 139
Registered: ‎05-24-2011
My Device: Z30 running 10.2 and Playbook 4GLTE running OS2.1
My Carrier: rogers

Re: debugging the headless part...?

I'm writing the debug messages to stdout and flushing.  it works fine for the UI part, but the debug statements in the headless part don't get printed.. 

 

here's the message handler:

 

void myMessageOutput(QtMsgType type, const char* msg) {
//	Q_UNUSED(type);
	switch (type) {
	case 0:
		// 0 debug
		fprintf(stdout, "%s\n", msg);
		fflush(stdout);
		break;
	case 1:
		// 1 warn
		fprintf(stdout, "%s\n", msg);
		fflush(stdout);
		break;
	case 2:
		// 2 critical
		break;
	case 3:
		// 3 fatal
		break;

	}
//	fprintf(stdout, "%s\n", msg);
//	fflush(stdout);
}

 I sometimes comment out the part for debug and use qWarning() instead because some of the Cascades components are noisy on debug (like the MediaPlayer).

 

anyway, it works fine for the UI part, just not the headless part.  I'm not sure why.

 

while the app is running, i looked at the "Display Selected Console" dropdown (lower right of the screen) and I can find the UI part of the app there, but nothing for the headless part... 

 

I'll try writing it out to a file too, but if it doesn't make it to stdout, i'm not sure it will make it to a file either.

 

bron: a cron-like scheduler for BlackBerry 10
http://apps.oddelement.com
Developer
Posts: 139
Registered: ‎05-24-2011
My Device: Z30 running 10.2 and Playbook 4GLTE running OS2.1
My Carrier: rogers

Re: debugging the headless part...?

sorry to bump an old thread.

 

i'm still not able to see debug output from the headless part.

 

what am i doing wrong?

 

I can't get anything done without being able to at least see some debug output... help?

 

bron: a cron-like scheduler for BlackBerry 10
http://apps.oddelement.com
Developer
Posts: 293
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: debugging the headless part...?

you already had the answer I think?

If you absolutely must use a custom debug handler in your headless project, then write the logs out to a file. Otherwise i'd advise just to use qDebug without a custom handler, then you'll get the messages in the console