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
justindutoit
Posts: 401
Registered: ‎05-31-2009
My Device: Not Specified
Accepted Solution

Help! Logging won't work on Bold 9000 on startup

[ Edited ]

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

Kudos!
Message Edited by justindutoit on 10-08-2009 10:32 AM
Please use plain text.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Help! Logging won't work on Bold 9000 on startup

How does your logging code work? I haven't had problems with logging during the power-up phase on Bolds...
Please use plain text.
Developer
martijnbrinkers
Posts: 155
Registered: ‎02-18-2009
My Device: Not Specified

Re: Help! Logging won't work on Bold 9000 on startup

is content protection enabled? If so disable content protection. Debug log output is not written to the event log when content protection is enabled.
Please use plain text.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Help! Logging won't work on Bold 9000 on startup

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.

Please use plain text.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Help! Logging won't work on Bold 9000 on startup

Exactly as martijnbrinkers said, tests confirm that it is only the DEBUG level Event Log messages that aren't logged while content protection is active. So, logging on any other log level to the Event Log should work fine.
Please use plain text.
Developer
justindutoit
Posts: 401
Registered: ‎05-31-2009
My Device: Not Specified

Re: Help! Logging won't work on Bold 9000 on startup

OK folks, I think we're making progress, but now the logging isn't working at any time- but it's consistent :smileyhappy:.

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.

 

Please use plain text.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Help! Logging won't work on Bold 9000 on startup

You need to invoke EventLogger.register with VIEWER_STRING as before. ALWAYS_LOG is the log level for EventLogger.logEvent (either explicitly as the "level" argument, or implicitly, when using the two-argument variant).
Please use plain text.
Developer
justindutoit
Posts: 401
Registered: ‎05-31-2009
My Device: Not Specified

Re: Help! Logging won't work on Bold 9000 on startup

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

Please use plain text.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Help! Logging won't work on Bold 9000 on startup

[ Edited ]

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.

Message Edited by klyubin on 09-10-2009 12:42 AM
Message Edited by klyubin on 09-10-2009 12:44 AM
Please use plain text.
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Help! Logging won't work on Bold 9000 on startup

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.

Please use plain text.