An Introduction to The Android Log

Using and analyzing the Android log for debugging apps and understanding how the system works.

In this post I’d like to get you familiar with the Android log system. This is a fundamental source of information about the behavior of the system and is frequently used in the software cycle development. It is also extremely important when debugging your application or when customizing the Android ROM itself (in case you need Android to do advanced requirements).

Supposing you have an Android device, like for instance a smartphone or a tablet, the first and straighforward way to get more information about what’s happening behind the scenes, is to use the USB-to-MiniUSB cable and connect the device to the PC. If you have already installed the Android SDK, by typing the following command from the command line

adb logcat

you will immediately get some information about the system. An example of the output produced by the logcat on Android ICS is:

I/SensorService( 2212): 3-axis Accelerometer
I/SensorService( 2212): Intersil isl29018 Ambient Light Sensor
I/SensorService( 2212): Intersil isl29018 Proximity sensor
I/SensorService( 2212): ADT7461 Temperature Monitor
I/sysproc ( 2212): System server: starting Android runtime.
I/sysproc ( 2212): System server: starting Android services.
I/sysproc ( 2212): System server: entering thread pool.
I/SystemServer( 2212): Entered the Android system server!
D/SensorService( 2212): nuSensorService thread starting…
I/SystemServer( 2212): Entropy Service
I/SystemServer( 2212): Power Manager
I/SystemServer( 2212): Activity Manager
I/ActivityManager( 2212): Memory class: 64
F/BatteryStatsImpl( 2212): problem reading network stats
F/BatteryStatsImpl( 2212): java.lang.IllegalStateException: problem parsing idx 1
F/BatteryStatsImpl( 2212): at
F/BatteryStatsImpl( 2212): at
F/BatteryStatsImpl( 2212): at

Describing the Android log system in a couple of paragraphs is very difficult. However, you can think of it as the merge of different logging information available from different Android subsystems. The same Android log information is available on the DDMS perspective on Eclipse IDE.

eclipse ddms logcat

Android logcat is of utmost importance when developing new apps, however when you need to see what are the logging information of the kernel or kernel modules, you have to take other approaches. For instance, if you have an Android ICS, type the command:

adb shell

and when connected to the shell, type:


you will get the low level logging information that are extremely important when developing kernel modules or when dealing with special customization of the Android system.

alarm_set_rtc: Failed to set RTC, time will be lost on reboot
request_suspend_state: wakeup (3->0) at 20282039697 (1970-01-02 00:00:04.371084282 UTC)
dm9000 dm9000: eth0: link down
ADDRCONF(NETDEV_UP): eth0: link is not ready
init: start ~~~~~~~~ dhcpcd_eth0:-h android-b729056a8fa357e eth0
init: cannot find ‘/system/busybox/bin/busybox’, disabling ‘preinstall’
init: start ~~~~~~~~ dhcpcd_eth0:-h android-b729056a8fa357e eth0
request_suspend_state: wakeup (0->0) at 45233170762 (1970-01-02 00:00:29.322215223 UTC)
init: untracked pid 2273 exited

Android touch panel
with IP54 or IP40 Ingress protection

Every system is based on a special low-level code (called bootloader) that is executed when the system starts. Since there is no direct connection between the Android log system and the bootloader, these information are displayed using another channels. To show you how to gather this log, we took this Android touch panel because it has a serial port that outputs bootloader status logs.

To do so:

  • take a DB9 serial cable
  • connect it to a PC (eventually using a USB-to-serial converter)
  • open Hyperterminal (on Windows) or minicom (on Linux)
  • specify the following serial port parameters: 115200 8-N-1 (might be specific to this Android touch panel)
  • switch on the Android panel

Hit any key to stop autoboot: 0
reading kernel.. 1073, 8192
MMC read: dev # 0, block # 1073, count 8192 …8192 blocks read: OK
reading RFS.. 9265, 6144
MMC read: dev # 0, block # 9265, count 6144 …6144 blocks read: OK
Boot with zImage
——– 0 ——–

Starting kernel …

Uncompressing Linux… done, booting the kernel.
Initializing cgroup subsys cpu
Linux version 3.0.8 (lino@lm) (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #69 PREEMPT Tue Oct 22 22:10:57 CEST 2013
CPU: ARMv7 Processor [412fc082] revision 2 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache

As usual, suggestions and comments are welcome! 🙂