The Android log system provides the ability to record and view system debug information.
The Android log information has a tag and output level. The output level from low to high can be divided into several levels:
V (Verbose)
D (Debug)
I (Info)
W (Warn)
E (Error)
F (Fatal)
S (Silent)
When using eclipse development, we can easily use the DDMS logcat tool to easily view log information
During the code debugging process we can also use the Logcat tool to facilitate debugging code, the program we can actively write to the Android logbook, and through the filter to quickly find out if there are no error alerts appear. Let's take a brief introduction to an example.
Create a project and add the following code to the Mainactivity Oncreat method
@Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview ( R.layout.activity_main); Add a log message log.i ("TAG", "This piece of information, located in the text position");}
Click the green plus sign at the Logcat toolbar
Displays the following information
Filter Name: Filters names
By Log tag: Search by tag
By log message: Find log information with input information by fuzzy matching of log-related information
By PID: Filter By Application ID
By Application Name: match the output log application
By log levels: All information at the log information level above the selected level (including the selected level).
Several filtering information for the relationship with the more filtering information to find more accurate.
We enter the following information, indicating that the filter name is 1, the search label (tag) is tag, the output information contains text.
The results are as follows
If we modify the by Log message content as follows
The results are as follows
Logcat view Android run log