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