Debugging in PhoneGap

There is a combination of techniques that you have to employ.

JavaScript syntax errors that leave you dumb struck are best handled by debugging on Android using the Eclipse Logcat.

JavaScript debugging is best handled on iOS with console.log, which you can look up in Safari Developer by selecting the iOS log. In contrast to logcat, you can see complex structures such as JSON directly.

Windows Phone has no direct console access. So you need to do alert with JSON.stringify on the data.

Becuase alerts will slow you down, and sometimes cannot be issued, an alternative is to append log messages to a HTML element on the screen, using:

$('#log').append('your message here!');

Callback occur asynchronously when you cannot predict the screen you will be at when they occur, so a way to log something is to store it in local storage with window.localStorage.setItem.

To look for occasional crashes, especially when the non standard plugins are involved, look at the XCode console for iOS and the Logcat view of Eclipse for Android.