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
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: EMPTY EventLog

do it in landscape mode
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: EMPTY EventLog

You need to be on the Ribbon or Home Screen (displaying application icons) for this to work.  Can you give us a screen shot that includes the area above the keyboard to prove you were on the Ribbon?

Trusted Contributor
trupti
Posts: 242
Registered: ‎03-16-2010
My Device: 9530

Re: EMPTY EventLog

 

Peter, I am not in Home Screen (displaying application icons) i.e. on Downloads page. I am on my application's Home page. Home Screen  means I always thought app home screen, as that's where we register to start communicating with the logger. But I was so wrong.

 

But as you said, I tried when was on home screen (application icons) and it came up. It had leve las Warning, which I changed to Information, Debug Info and also deleted all contents from the logger. Re-Started my app. But in none of the levels, my text i.e. "Registered Log" or anything else came up.

 

For such general info to come up, what leve lshould I choose in my app where I have set  EventLogger.VIEWER_STRING.

 

I just want the freedom to enter anything, may be normal text for error or warnings. Which level should I give in app and set in Event Logger on simulator to test.

 

 

Thanks 


--------------------------------------------------------------------------------
For any helpful answers give kudo's (star) to the helper.
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: EMPTY EventLog

The BlackBerry Event Log is used by all applications.  I think this is good, because it means that you put something in there, you can see how it related to other things that are going on, on the device. 

 

There is a sample Logger class that uses this in the code you will find here:

http://supportforums.blackberry.com/t5/Java-Development/Sample-HTTP-Connection-code-and-BIS-B-Access...

 

The Event Log is usually set to ignore events that are below a specific level.  The user can change this level.  So if you have a need to collect additional data from the device, you can get the user to change the logging level.  The default level is warning. 

 

So you decide which messages you want to log, and set a level for these message, say to one of, INFO, WARN, ERROR or SEVERE.  By default, the information ones will not end up in the Event Log.  But if you have a need for detailed debugging, they are there and can be captured. 

 

You will notice that in addition to putting these messages in the Event Log, the Logger class also dumps them to System.out.println on the Simulator.  This means you will see all the messages when on the SImulator.  This seems to work well for me. 

 

Anyway, I would recommend that you try the sample application from the link above in your Simulator and see if you see the Logged entries.  Assuming you do, then replicate the Logger class into your own application to resolve your problem. 

Trusted Contributor
trupti
Posts: 242
Registered: ‎03-16-2010
My Device: 9530

Re: EMPTY EventLog

 

Thanks Peter,

 

    I tested the code and the application. Couple of points :

  1. You basically create a object of HashTable (RuntimeInfo) and store it in non-persistent RuntimeStore on device itself.
  2. RuntimeStore is signed, so do I have to sign it when I receive the signing key. If i sign it, suppose the app faces any problem and I want to refer the logs then can I use another app with same GUID & track the logs from RuntimeStore (provided the device is not switched off).
  3. Storing such data wont occupy memory space of the device and maybe slow down the process ?

I had similar idea but instead of working with PersistentObject was thinking of using Flat files (as we do in desktop applications). I was thinking of file just b'coz it becomes easy for a user to open the file or send the company the file and can check the logs. Their need not be any application to read logs.  

 

Your Get & POst also I will just try using a web service and see the results. I just did Get with the std blackberry.com url, and I got hte logs but they were quiet less than displayed on SOP's. I guess that's b'coz of substring will RETAIN_LOG_LENGTH i.e. 200, so only 200 chars must be visible.

 

 

I hope you are getting my points properly and would be able to answer them appropriately.

 

Thanks

 


--------------------------------------------------------------------------------
For any helpful answers give kudo's (star) to the helper.
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: EMPTY EventLog

Sorry the only class I expected you to look at is Logger, and the way it is used.  The other stuff is intended for people trying to do http requests - the application should provide a framework for this.

 

With respect to logging, the application writes to the EventLog.  it also keeps an in memory copy of the log, but that was not the point.  You were complaining that you could not get your code to write to the Event Log.  The sample should correctly write to the Event Log.  Replicate the code used in the sample to write to the Event Log and it should fix your problem. 

 

So I recommend that you look at the Logging class, as it relates to getting entries into the Event Log, to get your code working.

 

Regarding the other stuff:

a) You can use SD Card (i.e. flat files) for the log and for your persistent configuration information if you want.  I personally don't, but that is because I don't want my applications to stop working if the user pulls the SD Card. 

b) Yes it would be possible to pull the log off the device as you suggest from another application.  However I have never had to do that.  I have yet to have a situation where the application failed and I needed the logs.  Typically when the applicant fails and won't restart, it is serious enough to be obvious where the problem is.

c) I think the log is 100 lines of 200 characters, which will end up being about 40 KB, which I don't think is too large an amount, given that most devices have over 256 MB RAM.  Look at the size of a typical email.