Mobile Development 6 min read

Retrieving and Analyzing Android Logs for Bug Diagnosis

This article explains how to capture Android device logs using adb commands, export them, combine with monkey testing, and then analyze logcat output—including ring buffers, priority levels, and common crash or ANR patterns—to efficiently locate and resolve issues.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
Retrieving and Analyzing Android Logs for Bug Diagnosis

In daily testing, bugs often require log inspection to pinpoint problems; this guide introduces methods for obtaining Android logs and performing analysis for issue localization.

1. Getting logs

1) Use adb logcat command : Open a CMD window and run a command such as adb logcat -v time > d:\fatal1.txt to save the system log to a local file. The -v option specifies the output format.

2) Use adb pull to export logs : Execute adb pull /sdcard/logs/logcat.txt ./local_folder (if no local path is given, the file is saved to the current directory).

3) Combine adb logcat with Monkey testing : Start a second CMD window, run adb logcat -v time | monkey -p com.example.app -v 500 , and stop logging with Ctrl+C after the Monkey test finishes.

2. Analyzing logs

Log entries begin with a marker like --------- beginning of xxxx , indicating the start of a circular buffer capture. Android provides several circular buffers:

Radio – wireless/network/telephony logs

System – system component logs

Event – event/receiver logs

Main – all Java‑level logs not belonging to the above

Crash – logs written when an app crashes

Log priority levels are:

V (Verbose) – lowest, detailed debug info

D (Debug) – common for development debugging

I (Info) – general runtime information, often full English sentences

W (Warning) – non‑fatal warnings, e.g., caught exceptions

E (Error) – errors affecting execution, such as crashes

F (Fatal) – severe errors, mainly from the kernel

S (Silent) – disables logcat output

3. Locating specific problems

1) Crash analysis : Search the log for the keyword FATAL . Verify that the surrounding process name matches the tested app’s package; then examine the surrounding stack trace to identify the cause (e.g., activity launch failure) and provide the log to developers.

2) ANR (Application Not Responding) analysis : Search for the keyword ANR . Pull the trace file with adb pull /data/anr/trace.txt and inspect it for Dalvik Thread entries to locate the thread causing the freeze.

After analysis, the relevant log sections should be handed over to developers for fixing the identified issues.

Promotional note : Qtest is the professional testing team of 360, leading web platform testing automation and efficiency.

debuggingAndroidcrash analysismobile testingANRADBLogcat
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.