ADB logcat command to view and filter Android output log

Source: Internet
Author: User

ADB logcat command to view and filter Android output log

CMD command line using the ADB logcat command to view the Android system and the application's Log,dos window press CTRL + C to interrupt the output log record.

Logcat Priority/tag tags in the log:

Each log of the Android output has a tag and priority associated with it.

The priority is the following character, in order from low to High:
V-Detail verbose (lowest priority)
-D Debug Debug
I-Info info
W-Warning warn
E-Fault Error
F-Critical Error fatal
S-No record silent

A token is a short string that identifies the source of the original message. The following is a log output message with a priority of "D", labeled "Powermanagerservice":

D/powermanagerservice (305): Onsensorchanged:light value:306.0
Use the Logcat command to view the Android log output:

ADB logcat//Show All logs
ADB logcat > C:\test.log//Save the log to a file Test.log

Filter log output based on tag tag and level:

Only the output is marked "Activitymanager" and the priority is greater than or equal to "Info" and the log marked as "Powermanagerservice" with a priority greater than or equal to "Debug":

ADB logcat activitymanager:i Powermanagerservice:d *:s

Note: *:s is used to set the log priority for all tags to s, which ensures that only eligible logs are output.

ADB logcat *:w//Show all logs with priority greater than or equal to "warning"

ADB logcat-s powermanagerservice//Display Powermanagerservice log information

Logcat Command list:

-D exit after displaying the log in the console
-C Clean up existing logs
-F <filename> Output the log to a file
ADB logcat-f/sdcard/test.txt

-V <format> set log Input format control output field, default is brief format

brief-Show priority/tag and PID of the original process (default format)
process-Show only Process PID
tag-only show priority/tag
thread-Show only processes: threads and priorities/tags
raw-Display the original log information, no other metadata fields
time-display date, call time, priority/tag, PID
long-display all metadata fields and separate message contents with blank lines

ADB logcat-v thread//using the thread output format
Note Only one format can be specified in the-v option.

-B <buffer> Loads a log buffer that can be used for viewing, and the default value is main.
radio-viewing buffer messages that are contained in a wireless/phone-related
events-viewing event-related messages
main-Viewing the primary buffer (default buffer)

ADB logcat-b Radio//View radio buffers

ADB logcat command to view and filter Android output log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.