07-23-2008 05:33 PM
To get the event log from a BlackBerry device as a file you can use javaloader.exe. This is included in the jde and can be found in your jde bin directory.
Connect your device to your computer via usb and run the command:
javaloader.exe -u eventlog > eventlog.txt
07-24-2008 05:30 AM
Is there any way we can get the EventLogger logs in our application ?
How this javaloader.exe might be doing it?
07-24-2008 05:35 AM
There are APIs to write information TO the event log (net.rim.device.api.system.EventLogger), however there are no APIs to read information FROM the event log. If you want to keep track of events that you have writtent to the event log, you can do so by keeping a copy of these event within your own application.
Nice post, thanks Kurt!
Tariq
07-24-2008 05:21 PM - edited 07-24-2008 05:22 PM
Unfortunately, this strategy of keeping a copy of the events doesn't allow you access to the stack trace - the most important part of the Exception for those trying to resolve the issues. The stack trace is removed and is not accessible. Also, printWriter() is not implemented, so there is no way (that I have found) to retrieve the stack trace programatically. You can print it out to the output stream, but this is pretty worthless when the device is in the customer's pocket.
We usually try to get the user to invoke <alt> LGLG, then locate and copy the exception trace. 80% of users won't do it, most of the users who try don't get the correct info. This is very high up the list of headaches for our support folks.
If anyone has found a work-around to retrieve this data programmatically, I'd love to hear about it.
07-24-2008 05:43 PM
Well, I have a really ugly way of doing it...
I create my own ExceptionWrapper that has a StringBuffer and an addTraceLine() method that appends to the SB. When I catch an exception, I test to see if it's an ExceptionWrapper. If it is, then I simply call the addTraceLine() method with some location info and pass the exception up the chain. If it's not an ExceptionWrapper, I create one and wrap the base exception in it and pass it on up. When the exception percolates top the top, you can then print the base exception's stack trace to the log and display the accumulated app traces including the base exception's message.
Because this method requres extra try/catch blocks, I generally use it sparingly.
07-24-2008 05:50 PM
07-25-2008 05:38 AM
Thanks all for the feedback. In the mean time, there's a way to print the stack trace.
The BlackBerry® JVM is optimized to eliminate the stack trace if it locates code that catches the exception using catch (Exception e). It does not eliminate the stack trace if your application catches the Throwable exception.
Take a look at the bottom of page 32 in the JDE Fundamentals Guide for an example: http://www.blackberry.com/knowledgecenterpublic/li
Hope that helps.
Tariq
07-25-2008 08:55 AM
Yes, you can print the stack trace to "standard error" stream, but this does you absolutely no good if the phone is out in the world, not connected to your debugger. This info is also logged to the "system event log", which cannot be retrieved programmatically (without user assistance or intervention).
What we are looking for is a way to retrieve the stack trace info programmatically so that it can be use by support folks and/or developers to track down the root cause of the exception.
-de
09-22-2008 02:26 PM - edited 09-22-2008 02:27 PM
RexDoug wrote:
What we are looking for is a way to retrieve the stack trace info programmatically so that it can be use by support folks and/or developers to track down the root cause of the exception.
Ditto.
I would like to be able to read the event log programatically.
09-22-2008 06:27 PM