10-07-2009 07:28 PM - edited 10-07-2009 07:32 PM
Hi gents. I'm just reposting this as I'm still looking for an answer: I have an app which needs debugging and I'm using the event log to help me. However, on my Bold 9000 handheld, it won't log when I put the logging code in main() for running on startup. It works on the simulator fine. I'm using v4.6. My app is a CLDC app, a system module which auto-runs on startup. It has an Alternate Entry Point for when you click on the icon, which works fine.
If I put the logging code in the constructor, it doesn't work either. My code is signed. I need to see what's going on, so I need this logging to work. Then fixing my code should be quite simple.
Appreciate any help,
Justin
Solved! Go to Solution.
10-08-2009 05:03 AM
10-08-2009 05:25 AM
10-08-2009 05:51 AM
Thanks, marijnbrinkers! I didn't belive it at first. I tested your claim and indeed, when content protection is on, debug messages aren't logged in Event Log, whereas ALWAYS_LOG message still are.
I guess one solution is to log important messages during startup on the ALWAYS_LOG level.
10-08-2009 06:05 AM
10-08-2009 07:00 PM
OK folks, I think we're making progress, but now the logging isn't working at any time- but it's consistent
.
Before the change, it logged when I clicked on the app icon, but not when the Bold started up. Now it doesn't log at all- but I still think we're making progress. Before, I used VIEWER_STRING instead of ALWAYS_LOG.
How do I fix this so it logs all the time? The code I'm using to log is below:
EventLogger.register(0x4c9d3452d87922f2L, "MonthlySpend", EventLogger.ALWAYS_LOG);
String logMessage = "main... ";
if (args != null && args.length > 0)
logMessage += args[0];
if (EventLogger.logEvent(0x4c9d3452d87922f2L, logMessage.getBytes())) {
System.out.println("Log Successful!");
}
On my Bold, in the log it says Event Log(Warning)- I don't know what Warning means. Also I'm not sure how to disable Content Protection. Maybe you could put all your ideas in the one post (living in Australia I have to wait a day because of the timezone difference)?
Appreciate any help,
Justin.
10-08-2009 07:05 PM
10-08-2009 07:27 PM
Tks- but since I'm already using the two arg version of
EventLogger.logEvent(0x4c9d3452d87922f2L, logMessage.getBytes())
that means it's already ALWAYS_LOG, and yet it isn't working on Bold startup ...
What's missing?
Ta,
Justin
10-08-2009 07:40 PM - edited 10-08-2009 07:44 PM
See my previous post: you need to invoke EventLogger.register with VIEWER_STRING instead of ALWAYS_LOG. Also, it's a good idea to check whether register returns true.
P.S. I always used the three-arg version of EventLogger.logEvent, where one explicitly specifies the log level. It was the three-arg version that seemed to work just fine (except for DEBUG level) in the test I did today and which I reported in this thread.
P.P.S. Event Log (Warning) means that the Event Log is only retaining messages logged at WARNING or higher (ERROR, FATAL) and ALWAYS_LOG, obviously. You can change the cut-off level in the settings of the Event Log viewer.
10-08-2009 07:47 PM
P.P.P.S. Content Protection can be disabled from the Options -> Security -> General Settings screen. There's a Enabled/Disabled dropdown for Content Protection. You may be unable to disable content protection if it's mandated by the BES IT Policy though.