Android Tutorials - Herong's Tutorial Examples - Version 3.02, by Dr. Herong Yang
"adb logcat" Command Arguments - Output Filters
This section describes how to use the 'adb logcat' command arguments to filter out unwanted log entries. 'adb logcat dalvikvm:V *:S' means dump all log entries from the Java Virtual Machine, dalvikvm, and nothing from all other processes.
If you look carefully in the output of the "logcat" command, you will that each log entry is associated with a priority code and a process tag name.
In the output of the "brief" format, the first field is the priority code and the second field is the process tag name. For example, the following "brief" log output shows that the priority code is "E" for Error and the process tag name is "AndroidRuntime":
E/AndroidRuntime( 77): java.lang.NullPointerException
As another example, the following "long" log output shows that the priority code is "F" for Fatal and the process tag name is "BatteryStatsImpl"
[ 04-01 16:04:07.239 77:0x5e F/BatteryStatsImpl ] problem reading network stats java.lang.IllegalStateException: problem parsing idx 1 at com.android.internal.net.NetworkStatsFactory.readNetwor... at com.android.internal.net.NetworkStatsFactory.readNetwor... at com.android.internal.os.BatteryStatsImpl.getNetworkStat... at com.android.internal.os.BatteryStatsImpl.access$100(Bat... ...
In order to help you to focus on log entries that interested to your debugging goal, "adb logcat" command allows you to specify filters as command arguments as:
adb logcat <options> <process-tag>:<priority-code> ...
When filters are provided, the "logcat" command will dump log entries that are generated from specified processes with priorities higher than the specified code, plus all log entries that generated from unspecified processes.
A wildcard character, "*", can be used to represent all processes
Below is a list of all priority codes that can be used in the "logcat" command:
Here are 2 examples of using filters with the "adb logcat" command:
1. To dump all log entries with "I (for Info)" priority and higher from all processes - The default behavior of the logcat command:
C:\herong>\local\android-sdk-windows\platform-tools\adb logcat \ *:I ... W/ThrottleService( 77): unable to find stats for iface rmnet0 F/NetworkStats( 77): problem reading network stats F/NetworkStats( 77): java.lang.IllegalStateException: problem pa... F/NetworkStats( 77): at com.android.internal.net.NetworkStatsFa... F/NetworkStats( 77): at com.android.server.NetworkManagementSer... ...
2. To dump all log entries from "dalvikvm (the Java Virtual Machine)" and nothing from all other processes:
C:\herong>\local\android-sdk-windows\platform-tools\adb logcat \ dalvikvm:V *:S ... D/dalvikvm( 77): GC_CONCURRENT freed 516K, 14% free 11320K/13063K... D/dalvikvm( 158): GC_CONCURRENT freed 384K, 6% free 9529K/10119K, ... D/dalvikvm( 172): GC_FOR_ALLOC freed 2288K, 22% free 17742K/22727K... D/dalvikvm( 172): GC_FOR_ALLOC freed 388K, 18% free 18734K/22727K,... D/dalvikvm( 172): GC_CONCURRENT freed 2795K, 22% free 17941K/22727... D/dalvikvm( 172): GC_CONCURRENT freed 1307K, 19% free 18629K/22727... ...
Last update: 2015.
Table of Contents