Android source code debugging-view logs

Source: Internet
Author: User

If you want to debug the android source code or conduct Process Research on a module of Android, it is essential to view logs.

However, the number of logs provided by the system is too small to be tracked.

So how can we let the system provide more logs.

After researching the source code, we can find that the source code is used in a large amount when printing logs.

Public static Boolean isloggable (string tag, int level)
By taking a closer look at the API, we can see that this method is to compare the Log Level of the corresponding tag with the level. If it is not smaller than the level, it will be printed. Almost all systems are judged at the verbose level, and the default Log Level of the system is info.
In this case, the system only prints info information, and a lot of verbose information is invisible.
How can we change the default Log Level of some system applications.
There are two methods, one is to create a file/data/local. Prop
log.tag.<YOUR_LOG_TAG>=<LEVEL>

The front is the log label, followed by the level.
In the ADB shell, enter the command

setprop log.tag.<YOUR_LOG_TAG> <LEVEL>

Of course, it is better to change the level to verbose if you want to view detailed logs.
I personally prefer the second method, which is relatively simple.
For example, you only need to enter

In this way, you can see detailed verbose-level logs.



Someone may want to ask how to obtain the tag. I found this in the source code. If you need the tag of another application, I will add it to the article later.
Wu Dongdong lastsweetop -- 20110817
Reprinted please indicate the source: http://blog.csdn.net/lastsweetop/article/details/6696217

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.