08.16
Sometimes i need to see the system log from my android mobile. As root on android i can see this in the terminal with dmesg. But i want to see it on my desktop computer.
The Android SDK has the solution. Simple setup adb to work proper and then type adb logcat in the desktop shell. (be warned this put large text message in your shell)
[android@fedora android]$ ./adb logcat
V/WifiMonitor( 1075): Event [CTRL-EVENT-STATE-CHANGE id=1 state=7]
V/WifiStateTracker( 1075): Changing supplicant state: GROUP_HANDSHAKE ==> COMPLETED
D/dalvikvm( 1360): GC freed 611 objects / 28528 bytes in 193ms
D/dalvikvm( 1360): GC freed 558 objects / 26376 bytes in 188ms
D/dalvikvm( 1360): GC freed 523 objects / 24848 bytes in 495ms
V/GameService( 1430): mobi.sportstap.provider.schedule.ACTION_SCHEDULE_ALARM
V/GameService( 1430): RefreshSchedule
V/GameService( 1430): mobi.sportstap.provider.schedule.ACTION_AUDIT_ALARM
V/GameService( 1430): game update alarm set
V/GameService( 1430): schedule refresh alarm set: 16 Aug 2009 15:50:13 GMT
V/ScheduleBroadcastReceiver( 1430): Intent received: mobi.sportstap.broadcast.widget.APPWIDGET_NO_NET
D/dalvikvm( 1430): GC freed 669 objects / 37848 bytes in 188ms
[... and so on]
To stop type STRG+C. The command adb logcat > log_android.txt generate a textfile with the log messages.
You can actually type “lolcat” instead of “logcat”
someone on Google was a bit bored i think.
And if you want timestamps, write “adb logcat -v time”, and another way to pipe the output is to do “adb logcat -f /sdcard/log_blabla”, but it has to be a path on the device
“adb logcat -c” clears the buffer from messages.
DDMS will also give you this, but slightly clearer to read
Thanks for your tips. Especially for lolcat
Here is a tool to enhance your logcat experience
Windows link http://adrianvintu.com/blogengine/post/Colored-Logcat-Script-for-Windows.aspx
Linux link http://jsharkey.org/blog/2009/04/22/modifying-the-android-logcat-stream-for-full-color-debugging/
BR,
Adrian Vintu