Over a million developers have joined DZone.

Yet Another Cordova/PhoneGap Debugging Tip

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

Want another way to debug Cordova/PhoneGap apps? This isn't new, but I tend to forget about this option and it came in handy yesterday so I thought I would share. When you send builds to the simulator/device via the command line, you may notice that at the end of all the output about building this and generating that, you get these two lines:

2014-07-14 17:23:36.846 ios-sim[1335:507] stderrPath: /Users/ray/readtextfile/platforms/ios/cordova/console.log
2014-07-14 17:23:36.847 ios-sim[1335:507] stdoutPath: /Users/ray/readtextfile/platforms/ios/cordova/console.log

What this is telling you is that you have a log file that will report on errors from your application. This also includes console.log output. (As well as console.dir.) If you simply tail -f this file in another terminal tab (and yes, you get tail -f in Windows too with the right download), you get your console output as plain text right in your terminal. Here is an example from what I was working on yesterday.

Edit on July 16: As just an FYI, when I just tested this on a new app this morning, it did not work. I had to add the Console plugin. My initial test was with a Ionic app where this was added automatically.


The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!

Topics:

Published at DZone with permission of Raymond Camden, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}