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

Web and WebWorks Development

Reply
New Developer
mattgaunt
Posts: 21
Registered: ‎07-13-2009
My Device: Not Specified
Accepted Solution

BB Web App and Javascript native output logging

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

Please use plain text.
Developer
jmace
Posts: 482
Registered: ‎10-24-2008
My Device: 9300

Re: BB Web App and Javascript native output logging

[ Edited ]

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;
}

 

 

_________________________________________
www.jasonmace.com/blackberry
Please use plain text.
New Developer
mattgaunt
Posts: 21
Registered: ‎07-13-2009
My Device: Not Specified

Re: BB Web App and Javascript native output logging

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

Please use plain text.
Developer
jmace
Posts: 482
Registered: ‎10-24-2008
My Device: 9300

Re: BB Web App and Javascript native output logging

[ Edited ]

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?

_________________________________________
www.jasonmace.com/blackberry
Please use plain text.
Developer
jtyberg
Posts: 124
Registered: ‎09-06-2010
My Device: Not Specified

Re: BB Web App and Javascript native output logging

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.



Please use plain text.
New Developer
mattgaunt
Posts: 21
Registered: ‎07-13-2009
My Device: Not Specified

Re: BB Web App and Javascript native output logging

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).

Please use plain text.