Log usage in Android

Source: Internet
Author: User

1. log on.

CodeAs follows:

 
Package COM. example. hello; import android. OS. bundle; import android. app. activity; import android. util. log; import android. view. menu; public class mainactivity extends activity {@ override protected void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. activity_main); log. V ("Fighting", "Zhang Zetian is a JavaProgramMember goddess 1 "); log. D ("Fighting", "Zhang Zetian is Allen's Goddess 2"); log. I ("Fighting", "We all like Zhang Zetian 3"); log. W ("Fighting", "Zhang Zetian ~~~~~ 4 "); log. V (" Fighting "," Come on !!! 5 ") ;}@ override public Boolean oncreateoptionsmenu (menu) {// inflate the menu; this adds items to the action bar if it is present. getmenuinflater (). inflate (R. menu. main, menu); Return true ;}}

2. View logs

1) logcat

Click logcat. The following page is displayed in this perspective:

2) (create a LOG filter, which is mainly used to find what you need among many logs)

Click the Green Cross above to see the following interface:

At this time, we can easily find the log we need .. In fact, 1) the graph used is the log obtained after the filter is used.

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.