"adb logcat" Command - Displaying System Logs

This section describes the 'adb logcat' command that can be used to print out Android system log data for debugging purpose.

When developing new Android applications, you have to learn some tools to help you to debug the code. The primary debugging tool provided in the Android SDK is the Android Debug Bridge (ADB) program.

In previous tutorials, we learned how to use the following ADB commands:

ADB also has another very useful command that can be used to debug applications:

Let's starts the Android emulator and run the "adb logcat" command to see what we are getting:

C:\herong\>\local\android-sdk-windows\platform-tools\adb logcat

W/Zygote  (   37): Preloaded drawable resource #0x108022c \
   (res/drawable-hdpi/dialog_top_holo_dark.9.png) that varies with \
D/dalvikvm(   37): GC_EXPLICIT freed 3K, 1% free 8601K/8643K, \
   paused 3ms+4ms
I/Zygote  (   37): ...preloaded 31 resources in 50ms.
D/dalvikvm(   37): GC_EXPLICIT freed 29K, 1% free 9028K/9091K, paused 3ms+4ms
I/dalvikvm(   37): System server process 77 has been created
I/Zygote  (   37): Accepting command socket connections
E/BatteryService(   77): usbOnlinePath not found
I/sysproc (   77): Entered system_init()
I/sysproc (   77): ServiceManager: 0x1e4ad0
D/SensorService(   77): nuSensorService starting...
I/SensorService(   77): Goldfish 3-axis Accelerometer
I/SystemServer(   77): Activity Manager
I/ActivityManager(   77): Memory class: 48
F/BatteryStatsImpl(   77): problem reading network stats
F/BatteryStatsImpl(   77): java.lang.IllegalStateException: \
   problem parsing idx 1
F/BatteryStatsImpl(   77): 	at com.android.internal.net. \
   NetworkStatsFactory.readNetworkStatsDetail \
F/BatteryStatsImpl(   77): 	at com.android.internal.net. \
   (NetworkStatsFactory.java:250) \
F/BatteryStatsImpl(   77): Caused by: java.io.FileNotFoundException: \
   /proc/net/xt_qtaguid/stats: open failed: ENOENT \
   (No such file or directory)
F/BatteryStatsImpl(   77): 	at libcore.io.IoBridge.open \
F/BatteryStatsImpl(   77): 	at java.io.FileInputStream.<init> \
E/AndroidRuntime(   77): Error reporting WTF
E/AndroidRuntime(   77): java.lang.NullPointerException
E/AndroidRuntime(   77): 	at com.android.internal.os. \
E/AndroidRuntime(   77): 	at android.util.Log$1. \
E/AndroidRuntime(   77): 	at android.util.Log.wtf(Log.java:278)


Note that:

Actually, "logcat" is also available as shell command on the connected the device. You can run it directly in a shell interface window.

See the next tutorial on how to use "adb logcat" command options.

Last update: 2015.

Table of Contents

 About This Book

 Installing JDK 1.8 on Windows System

 Installation of Android SDK R24 and Emulator

 Installing Apache Ant 1.9 on Windows System

 Developing First Android Application - HelloAndroid

 Android Application Package (APK) Files

 Android Debug Bridge (adb) Tool

 Android File Systems

 Android 4.0.3 File Systems

 AboutAndroid - Application to Retrieve System Information

 android.app.Activity Class and Activity Lifecycle

 View Objects and Layout Resource Files

Using "adb logcat" Command for Debugging

"adb logcat" Command - Displaying System Logs

 "adb logcat" Command Options and Log Buffers

 "adb logcat -v" Command - Log Format Control

 "adb logcat" Command Arguments - Output Filters

 Using "adb logcat" Command to Track the Lifecycle of an Application

 Java Exceptions in AndroidRuntime Error Log

 Build Process and Package File Content

 Building Your Own Web Browser

 Android Command Line Shell

 Samsung Galaxy Tab 3 Mini Tablet

 USB Debugging Applications on Samsung Tablet

 Android Tablet - LG-V905R

 USB Debugging Applications on LG-V905R Tablet

 Android Phone - LG-P925g

 USB Debugging Applications on LG-P925g Phone

 Outdated Tutorials


 PDF Printing Version