Debug on the device with console.log(...)

by Developer on ‎10-15-2012 01:11 PM - edited on ‎10-15-2012 01:11 PM by BlackBerry Development Advisor (Retired) (5,332 Views)

Summary

 

This article applies to the following:

  • BlackBerry® 10 Native SDK 10.0.9 Beta 3
  • BlackBerry® 10 OS 10.0.9 Beta 3

 

Problem

 

The BlackBerry® 10 Native SDK 10.0.9 Beta 3 contains a known issue that prevents the JavaScript® console.log and QDebug messages from appearing in the console window.  

 

Cause

 

This is a known issue escalated to our internal development team for resolution in a future release.

 

Workaround

 

This article is about how to get the console.log() output while debugging your Cascades™ app.

 

I was wondering why my console.log(...) never was shown in the Console-Window in QNX® Momentics® IDE.

 

Here is a workaround:

 

  1. Right-click your project and set the build configuration to debug. build.png
  2. Build your project and run it as debug.debug.png
  3. Now when the project is running, you need to open a console. For this, open the QNX System Information perspective.
    perspective.png
  4. Now when you have this open, you can see your device. Your device must be in debug mode. First connect to it (via right-click > connect) and then open a SSH session.ssh.png
  5. Type the command: slog2info -w
    slog.png

 

Now, you can see the log output.  If you write some output in QML or JavaScript with console.log you will see it.