Use of Android log cat

Source: Internet
Author: User

Use of Android log cat

Android provides us with a log class, which has some methods such as

  

We can add these methods to our code to test

1  Packagecom.example.test;2 3 Importandroid.app.Activity;4 ImportAndroid.os.Bundle;5 ImportAndroid.util.Log;6 ImportAndroid.view.Menu;7 ImportAndroid.view.MenuItem;8 9 Ten  Public classMainactivityextendsActivity { One     Private FinalString tag = "Mainactivity"; A @Override -     protected voidonCreate (Bundle savedinstancestate) { -         Super. OnCreate (savedinstancestate); the Setcontentview (r.layout.activity_main); -          -        //System.out.println (1/0); -       +LOG.V (Tag, "I'm V"); -LOG.D (Tag, "I'm D"); +LOG.I (tag, "I Am I"); ALOG.W (tag, "I am w"); atLOG.E (Tag, "I'm E"); -System.out.println ("hehe"); -     } $}

Let's take a look at the information we get from the log cat.

  

We can see the error message by the level of the log, generally look at the error level or the Warn level basically know where the error occurred, but you can also test the error by creating a log filter

That is, the small green plus sign on the top, when clicked, pops up a dialog box, such as

  

When we look at the error message, we can click on the red box and select it to view it.

Use of Android log cat

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.