Android adb logcat Usage Tips

Source: Internet
Author: User

Preface the new notebook E431 installed the latest version of Eclipse, the Android development environment, but the logcat to see only the level, there is no error detailed information. I am not a willing to toss the GUI, more like the operation of pure command line, so today in Minghao brother's proposal, decisively abandon eclipse Logcat, to the ADB shell execution logcat.
The ADB logcatandroid log system provides a LOGCAT command that lets us track and view the system log buffers. The basic syntax is as follows:
[ADB] logcat [<option>] ... [<filter-spec>]

You can view the log output directly at the command line by using the following command:
ADB logcat

You can also execute the following commands directly after logging into the development machine via the ADB shell:
Logcat


Option options


I generally use-s to perform tag tags, for example:



Advanced features in ROM porting or other debug occasions, you need to combine filtering function to get the information you really need from logcat, and then introduce logcat two kinds of filtering implementation methods.
Filtering adb Logcat provides additional functionality to filter logs based on the log priority level. Use the following syntax:
ADB logcat *:#

Among them, #为下列选项之一:
    • V verbose, indicates all possible logs, default level
    • D Debug, indicating all reasonable debug logs
    • I information, which indicates the log when normal use
    • W warning, indicates there may be a problem, but no error has occurred
    • E error, indicates a problem, and causes an error
All priorities automatically contain a higher priority than it, such as Logcat *:i, which contains information, warnings, errors, and so on. Therefore, when the application crashes, it is more important to assemble logcat *:e to see the cause of the error, and it is necessary to look at the irrelevant debug logs.
grep for the output of the ADB logcat log content, we can also combine grep for further filtering operations. For example, I need to search for a log containing the "Wangzhengyi" keyword in the error report, which can be used as follows:
ADB Logcat *:e | Grep-i ' Wangzhengyi '





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.