Use LogCat and LogCat for Android Development

Source: Internet
Author: User

Use LogCat and LogCat for Android Development
What is a LogCat:

This is a tool used in Android development to display and print logs, similar to using system in java. out output, but in Android development, it is not only professional but also convenient to use logCat as much as possible. More importantly, this tool can provide many benefits and convenience, so let's take a look at how convenient it is.

2. Add LogCat to your Eclipse

 

Click Window> Show View> Other In the Eclipse navigation bar. A Show View dialog box is displayed. Expand the Android directory in the Show View dialog box and you will see a sub-item of LogCat.

Select LogCat and click OK. Then you can successfully add LogCat to Eclipse.


3. How does LogCat print the log level?
 

1. Log. v ()

This method is used to print the most trivial and meaningful log information. Verbose is the lowest level in Android logs.

2. Log. d ()

This method is used to print some debugging information, which is helpful for debugging programs and analyzing problems. Corresponding levels of debug, higher than verbose.

3. Log. I ()

This method is used to print some important data that you really want to see and can help you analyze user behavior. Corresponding Level info, higher than debug.

4. Log. w ()

This method is used to print some warning information, prompting that the program may have potential risks in this place. It is best to fix these warnings. Corresponding Level warn, higher than info.

5. Log. e ()

This method is used to print the error information in the program. For example, the program enters the catch statement. When an error message is printed, it usually indicates that your program has a serious problem and must be fixed as soon as possible. Corresponding Level error, higher than warn. This method is highlighted in red.

Therefore, many developers prefer this debugging.

 

Iv. How LogCat is displayed

 

The Log information is displayed in the text area, and different colors are displayed at different levels.

You can adjust the level to be printed here. The default value is verbose, which means printing all

 

You can also click the plus sign to print it based on your custom Tag. Sometimes there are a lot of things printed in the virtual machine or during debugging, so you can filter some desired information according to this method.

 

 

The last one is worth noting, that is, this search box can search the content you want in Text, and you can search directly. Is it very convenient.
 

Related Article

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.