Android Log Tool log

Source: Internet
Author: User

The Android Log tool class is log, which belongs to the Android.util.Log package, which provides 5 ways for us to print the log.

LOG.V (). Used to print the most cumbersome and least meaningful log information.  The corresponding level is verbose, which is the lowest level in the Android log. (by the way to meet the word---Verbose: lengthy, wordy, cumbersome, I am also Baidu's *_*)

LOG.D (). Used to print some debugging information, which is useful for debugging programs and analyzing problems. The corresponding level is debug, one level higher than verbose.

LOG.I (). Used to print some of the more important data that can help analyze user behavior data. The corresponding level is info, one level higher than Debug.

LOG.W (). Used to print some warning messages, suggesting that the program may have potential risks in this place, and it is best to quickly fix the place where the warning appears. Corresponds to level warn, one level higher than info.

LOG.E (). Used to print error messages in a program, such as a program entering a catch statement. When an error message is printed, there is a critical error message in the program that must be repaired as soon as possible. The corresponding level of error, higher than the warn level.

Of these five methods, each method will also have different overloads.

1 protected void onCreate (@Nullable Bundle savedinstancestate) {2         Super . OnCreate (savedinstancestate); 3         Setcontentview (r.layout.activity_login); 4         LOG.D ("Mainactivity", "onCreate execute"); 5 }  
View Code

LOG.D ("tag", "MSG"), add the Print log statement in the OnCreate () method.

The LOG.D () method needs to pass two parameters, the first parameter is the tag, generally passed in the current class name is good, mainly for printing information filtering; the second parameter is MSG, which is the specific content you want to print.

Tip: You can define tag as a tag constant: public static final String tag = "Mainactivity";

Android Log Tool log

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.