28

I am developing PhoneGap webapp where I use some javascript, and sometimes I need to see console.log() output. I can easily see it when running in Chrome, it also works fine, when running this app in Android emulator - output of console.log() shows up in Eclipse LogCat window. But when I run this app on my HTC Desire HD, LogCat just shows some Android-specific output, but nothing coming from my webapp.

Anybody has idea how to display console.log() output from PhoneGap-app running on HTC Desire HD ?

Frodik
  • 14,986
  • 23
  • 90
  • 141

4 Answers4

32

Another workaround is to use console.log() jsconsole.com

GK_
  • 1,212
  • 1
  • 12
  • 26
esamatti
  • 18,293
  • 11
  • 75
  • 82
19

See the PhoneGap mail list thread. Also, two stackoverflow threads here and here.

It seems that console.log is disabled on HTC devices running Android 2.2.

The best workaround I've found is to use weinre, which intercepts the console.log to show the output in its desktop browser console.

Update: PhoneGap 1.3.0 now supports console.log directly to LogCat from the HTC Evo without any workarounds. (The same program doesn't work with PhoneGap 1.1.0)

Community
  • 1
  • 1
Paul Beusterien
  • 27,542
  • 6
  • 83
  • 139
  • 2
    The 1.3.0 workaround in the guts of PhoneGap is to change DroidGap.init to call: // Set the nav dump for HTC settings.setNavDump(true); – Paul Beusterien Apr 04 '12 at 21:39
  • A lot of data seems to get dumped to the LogCat, so I'd suggest adding a filter, and filter by the Log Tag, "CordovaLog". Then from your PhoneGap Javascript you can simply call console.log("Message"); to output a message to the log. – Ciaran Gallagher Dec 12 '12 at 23:02
0

I've found that console.error gets higher priority than console.log , and appears in the adb logcat output for both emulator devices and real devices connected via USB.

Fiach Reid
  • 6,149
  • 2
  • 30
  • 34
-2

Try this filter:

adb logcat PhoneGapLog:V *:S

It will only show console.log and phonegap specific output.

Sam Croft
  • 15
  • 1