08-13-2010 06:06 AM
I'm trying to record some of the runtime logs on my local machine.
But I found I cannot use FileOutputStream, since I cannot import JRE6 once BlackBerry JRE 5.0 is imported. (It would cause error while compiling.)
Is there any easy way to write into files on local, in a class that is extended from UiApplication?
Solved! Go to Solution.
08-13-2010 06:44 AM
Not clear on what you are trying to do.
Remember that the code you write for a Blackberry runs on a BlackBerry, which is completely independent of any PC. SO you are not going to be able to do I/O to your PC's file system - the BlackBerry does not know about it. There are a few tricks that the Simulator pulls to make life easier for you when developing.
Regarding Blackberry specific class for logging, look at EventLogger.
08-13-2010 07:39 AM
"You can also use a local directory as your SDCard"
One of the tricks that the Simulator pulls. Remember that logging to the SD Card assumes that the user has an SD Card and that there is space and that they don't have anything else in the same place. I must admit I have resisted doing this. But it does work!
08-13-2010 07:42 AM
I agree with you to a certain degree Peter. But I usually give the user the option to choose where to save the log file. Either in the persistent store, SDCard, or local memory. It's easier to email the log as attachment when it's in the file system.