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
IK828
Posts: 132
Registered: ‎11-20-2009
My Device: Not Specified

Output to log/console

Sorry if this is a silly question.... but how do I show debug messages to console?

 

I am quite confused about how I can accomplish this... thanks :smileyhappy:

 

 

Please use plain text.
Developer
FredTBB
Posts: 36
Registered: ‎09-17-2012
My Device: 9810-Playbooks-devalpha-Z10
My Carrier: Free mobile

Re: Output to log/console

a simple printf will work

Please use plain text.
Developer
FredTBB
Posts: 36
Registered: ‎09-17-2012
My Device: 9810-Playbooks-devalpha-Z10
My Carrier: Free mobile

Re: Output to log/console

[ Edited ]

.

 

 

Please use plain text.
Developer
noahhuang
Posts: 100
Registered: ‎10-01-2012
My Device: BB10 Dev Alpha
My Carrier: Roger

Re: Output to log/console

qDebug() << "your message";

 

  • 1. In the IDE, in the Target Navigator view, right-click the device target. Click Launch SSH Session. 
  • 2. In the terminal that appears, do one of the following:      
    • a. To view the current slogger2 logs, type slog2info.      
    • b. To view real-time output for the processes that are being debugged (for applications that are running in development mode), typeslog2info -w.      
    • c. To view help information on slogger2, type slog2info -h.
    • slog2info -w |grep qt-msg   (filer the message)

 

Please use plain text.
Developer
nareshkodumuri
Posts: 125
Registered: ‎04-28-2012
My Device: BlackBerry 9800
My Carrier: BlackBerry

Re: Output to log/console

HI,

 

     Follow the below link this will help u.

     https://developer.blackberry.com/cascades/documentation/dev/upgrading/momenticschanges.html

 

Regards,

Naresh Kodumuri.

 

Please use plain text.
Developer
kanaksony
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Output to log/console

Hi,

 

Check this link.. This is a great solution...

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Please use plain text.
Developer
oliver_kranz
Posts: 216
Registered: ‎09-18-2009
My Device: Z10
My Carrier: O2

Re: Output to log/console

The workaround from the link below works like a charm for me.

 

http://supportforums.blackberry.com/t5/Cascades-Development/Workaround-Debug-messages-to-Console/m-p...

 

I have been told that this is only a temporary problem which will be fixed in the next release of the SDK.

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Output to log/console

It's worth pointing out that using the qInstallMsgHandler() approach probably slows down your app, and is otherwise more heavy on resources than the slogger2 approach which now appears standard.

Among the advantages of the slogger2 approach:

1. Writes to RAM disk (/dev/shmem/slogger2) so it's much faster in that respect and saves wear and tear on the flash storage.

2. Less impact on CPU load.

3. Reduced latency compared to what is probably a relatively heavy hit from the fflush() calls.

4. Output persists between invocations of the app, so you don't risk losing the output after a crash when you re-start the application.

5. Can probably leave your logging code in place even in production builds (as a result of all these things).

6. Built-in timestamping (to the millisecond).

7. "slog2info -w" provides continuous output across invocations, whereas "tail -f" has to be restarted with each launch. (This advantage is mainly for those who would manually do "tail -f logs/log" via SSH. Momentics basically does that for you.)

8. Easier combined log output when running two connected apps while testing Invocation Framework code.

There are probably other advantages. My point is, at least consider switching rather than unthinkingly sticking with the old console output just because it's more familiar to you.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.