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

Java Development

Reply
Developer
kzettel
Posts: 120
Registered: ‎07-16-2008
My Device: 9000

Get the event log as a file

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
This will contain your stack traces and other event information.  You can also view this on the device by typing ALT-LGLG but copying and emailing is pretty ugly.
Kurt Zettel | Chief Architect | Metova
www.metova.com
Please use plain text.
New Developer
satyam
Posts: 7
Registered: ‎07-18-2008
My Device: Not Specified

Re: Get the event log as a file

Is there any way we can get the EventLogger logs in our application ?

How this javaloader.exe might be doing it? 

Please use plain text.
BlackBerry Development Advisor (Retired)
ttahir
Posts: 36
Registered: ‎07-14-2008
My Device: Not Specified

Re: Get the event log as a file

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

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Get the event log as a file

[ Edited ]

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. 

 

 

Message Edited by RexDoug on 07-24-2008 05:22 PM
Please use plain text.
Developer
Developer
gtj
Posts: 319
Registered: ‎07-20-2008
My Device: Not Specified

Re: Get the event log as a file

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.

 

 

Please use plain text.
Developer
akirekadu
Posts: 52
Registered: ‎07-17-2008
My Device: Not Specified

Re: Get the event log as a file

It does sound ugly, but still a great idea, given all the limitations...
Please use plain text.
BlackBerry Development Advisor (Retired)
ttahir
Posts: 36
Registered: ‎07-14-2008
My Device: Not Specified

Re: Get the event log as a file

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/livelink.exe/BlackBerry_Java_Development_Environment...

 

Hope that helps.

 

Tariq

 

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Get the event log as a file

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

 

Please use plain text.
Developer
jonberry
Posts: 484
Registered: ‎07-17-2008
My Device: Not Specified

Re: Get the event log as a file

[ Edited ]

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.

Message Edited by jonberry on 09-22-2008 02:27 PM
Please use plain text.
Administrator
MSohm
Posts: 14,310
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Get the event log as a file

There are no BlackBerry APIs that allow reading of the BlackBerry event log.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.