4

I'm trying to make console.log() calls work in the remote debugging tool (using iWebInspector or Safari) & PhoneGap 1.4.1.

Somehow console calls only appear in XCode, looks like phonegap is somehow tweaking the console's method.

Any idea how I could make it work?

Olivier
  • 3,431
  • 5
  • 39
  • 56
  • A [related question](http://stackoverflow.com/questions/5847290/how-to-display-console-log-output-in-phonegap-app-using-eclipse-and-htc-desire) may offer some alternatives which will work. – Paul Sweatte Aug 22 '12 at 23:22

2 Answers2

0

Use "FireBug" (for Firefox, Chrome, IE), Firefox, or Chrome. "console" is a JavaScript object present only in some browsers.

Eduardo Cuomo
  • 17,828
  • 6
  • 117
  • 94
0

in the old phonegap 1.4.1 on iOS phonegap used to hijack the console.log object and redirect that into the xcode console.

if you want to change that you can include some code like this:

var old_log = console.log;
console.log = function(txt){

    //do something with log...

    if(old_log != null && typeof old_log == "function"){
        old_log(txt);  
    }
};
Daniel Kurka
  • 7,973
  • 2
  • 24
  • 43