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

Posts: 31
Registered: ‎07-25-2013
My Device: Q10
My Carrier: Vinaphone

Re: Best/Recommended way to log information in release build

Yes, combination of your answer with Issac's one solves the problem. Thanks Smiley Happy

Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Best/Recommended way to log information in release build

Also note the benefit of dkonigs' approach, where you leave things in the slog2 buffers unless a user actually takes action to retrieve them (at which point the app does the slog2 dump to file thing).

The slog2 output is kept entirely in RAM. It doesn't add any wear-and-tear to the flash storage, whereas if your app is constantly logging little bits to a file in the filesystem, that will waste more power and add more wear on the flash drive.

The flip side of this is that the slog2 stuff uses a circular buffer, so at some point older info will have been lost. If your purpose is to "catch" a problem shortly after it has occurred, then the slog2 method is probably best. If it's to grab a log from a long-running process with lots of output, then you probably need the filesystem based approach, despite the disadvantages. (Note that in that case you should consider having an in-app flag to let the user control this, so you aren't wasting power and flash unnecessarily across your entire user base.)

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!