11-04-2010 10:02 AM
Hey everyone,
I'm working on Blackberry to develop a web application and I've had to shift some of the tasks to a native hook.
Now developing the native hook for javascript to use seems fine, the biggest problem Im having is that I can't seem to connect to any sort of log (i.e. in the web app can I print out to some sort of log? From my native code I can't seem to System.out.print to the console because Eclipse views the project as a web app and seems to just set the console to some other view.
Can anyone give me any suggestions or correct me on how to get some sort of output?
Cheers,
Matt
Solved! Go to Solution.
11-04-2010 10:07 AM - edited 11-04-2010 10:08 AM
for debugging, you can create an extra DIV on your page and write to it...
****PSEUDO****
function log(message) {
var output = document.getElementById('debugDiv');
output.innerHTML = output.innerHTML + "<br>" + message;
}
11-04-2010 11:01 AM
Thanks for the response. I was hoping for something a little more robust.
Its seems ludicrous that the Command line doesn't connect to the simulator when running a web widget :-S
11-04-2010 11:07 AM - edited 11-04-2010 11:12 AM
What else would you like to be able to output for debugging?
Elaborate and I'll see if we can get there.
PS.... http://developer.yahoo.com/yui/logger/
would that fit the bill?
11-04-2010 12:08 PM
I created a JavaScript Extension (native code) that writes to the BlackBerry Event Log. I also use it as a feature in my Widget app and override console.log (and make it invoke the native Logger).
The good thing about the Event Log, is that it's on the device too. In the current state of debugging with the available tools, this feature has helped me enormously.
Use the Source. Or better, use phonegap and you get it for free.
The showeventlog app is the easiest way to view the event log on device/simulator.
11-09-2010 10:22 AM
The last suggestion seems like the most logical solution, although after trying it on a 5.0 simulator (Bold 9000) I couldn't get anything to print to the event log.
I've ended up creating a php script to query a local web service and then use a tail command on the file to print out the saved output (essentially acting as a log).