"adb logcat" Command Options and Log Buffers

This section describes the 'adb logcat' command options to dump and manage log buffers: main, events, and radio. An example is given to dump logs into a set of rotated log files.

To better use the "adb logcat" command, we need to look at its options:

Here are two examples of using "adb logcat" options:

1. To show the size of the default log buffer (main) and clear it on the connected device:

C:\herong\>\local\android-sdk-windows\platform-tools\adb logcat -g
main: ring buffer is 256Kb (212Kb consumed), max entry is 5120b, ...
system: ring buffer is 256Kb (70Kb consumed), max entry is 5120b,...
crash: ring buffer is 256Kb (0b consumed), max entry is 5120b, ma...   
   
C:\herong\>\local\android-sdk-windows\platform-tools\adb logcat -c

C:\herong\>\local\android-sdk-windows\platform-tools\adb logcat -g
main: ring buffer is 256Kb (98b consumed), max entry is 5120b, ma...
system: ring buffer is 256Kb (0b consumed), max entry is 5120b, m...
crash: ring buffer is 256Kb (0b consumed), max entry is 5120b, ma...

2. To continuously dump log entries to a set of 8 rotated log files of 1 MB each on the file system of the connected device:

C:\herong\>\local\android-sdk-windows\platform-tools\adb logcat \
   -f /sdcard/Download/Android.log -r 1024 -n 8

(leave it running)

See next tutorials on how to control the format of the "adb logcat" output.

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

 References

 PDF Printing Version