September 20, 2011 7

Monitoring console.log on PhoneGap Android

By

Update: I’ve written a small Python script to make the output easier to read. Read more about DroidLog.


Whilst debugging PhoneGap Apps/WebApps with Weinre is awesome, it does require your device/simulator to have a network connection to work. Most of the time this is not a problem but if/when you need to test how your app functions offline it becomes an issue.

Here’s an alternative solution I’ve found useful for monitoring console.log & console.error output from within the Terminal:

adb logcat | grep 'Web Console'

Hopefully this will be useful to a few others!

  • Anonymous

    I haven’t tried this yet but I’ll give it a go when I’m home. Looks like a good solution.

  • Sky Apperley

    Thanks for this. Been looking for a way to isolate web console from the noise of the adb output.

  • Pingback: DroidLog – A console/error log for Android PhoneGap apps » Joe Lambert

  • Ryan

    It’s actually better to just let logcat do the filtering for you, for example:

    adb logcat ActivityManager:I MyApp:D *:S

    Which is documented here:

    http://developer.android.com/guide/developing/debugging/debugging-log.html 

  • Phonegreper

    MS-DOS command line equivalent of above command: adb logcat | findstr “Web Console”

  • cirovladimir

    The only solution I have found that actually works! thanks!

  • happy7

    in my case, logging the device console output: adb -d logcat | grep CONSOLE