Android System Debug Output With Logcat
I’ve been asked many times how one might get some logging information when doing work on an Android phone. The answer has always been, and always will be “use logcat.” Just to be clear, logcat isn’t just some easy way do something like `cat /var/log/syslog`. It’s actually quite powerful. I always recommend having a terminal open and running logcat whenever you’re doing something on your phone or your emulator. It helps tracking down little nasties, and is a huge help when reporting bugs.
I’d write more on this, but Google has done an excellent job with the documentation. The only thing I would stress is getting very familiar with filtering log output. It will save you a lot of time if you know exactly what you’re looking for. Another tip that’s hidden at the bottom of the documentation is that by default, stdout and stderr are redirected to /dev/null. You can redirect them for visibility in logcat by doing the following:
$ adb shell stop $ adb shell setprop log.redirect-stdio true $ adb shell start
You can also set this by default in /data/local.prop.