Android.util.Log about Android development in print Log

Source: Internet
Author: User

  1. Daily Android Development Real-time debugging process often encounter the system log too much too fast, want to see the content of a flash over the problem. and customizing the log can be a good solution to these problems.

  2. Add Log in code

    The log output API is provided in ANDROIDSDK, in the Android.util.Log class.

    log.v (tag,message); Verbose mode, print the most detailed log

    log.d (tag,message); //debug's Log

    log.i (tag,message); //info's Log

    LOG.W (tag,message); Warn's Log

    LOG.E (tag,message); Log of error

    Corresponds to Verbose,debug,info,warn,error according to the initial letter.

    Tag and message are two string values, respectively

    Tag is used to mark the source of the log message. The message is the contents of this log.

    Look at the code I wrote here 5 lines of logs corresponding to different levels

  3. View Log

    The activity adds LOG.V to record the log output, as the result.

  4. ECLIPSE specifies that a tag information be viewed

    Of course, we can also specify to look at a log message, specifically in Eclipse Lohcat set the need to see the tag, visible in the red box in the picture. In the by log tag, set the log tag to read first.

  5. 5

    Here I set the tag to run the program.

  6. 6

    You can see the specified log information, so debugging the code is not very convenient.

Android.util.Log about Android development in print 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.