01-13-2011 06:55 AM
01-13-2011 07:10 AM
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?
01-13-2011 07:26 AM
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.
01-13-2011 08:09 AM
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:
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.
01-13-2011 10:13 AM
I tested the code and the application. Couple of points :
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.
01-13-2011 10:59 AM
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.