Andrews study notes ---- Android Studio and print the log Logcat simple tutorial

1. brief introduction:

The method of printing log has Andrews 5, respectively:
1.Log.v () - the VERBOSE
2.Log.d () - the DEBUG
3.Log.i () - the INFO
4.Log.w () - WARN
5 .Log.e () - ERROR

Intensity increment from top to bottom

Log section and constant source explained:

/**
     * Priority constant for the println method; use Log.v.
     */
    public static final int VERBOSE = 2;

    /**
     * Priority constant for the println method; use Log.d.
     */
    public static final int DEBUG = 3;

    /**
     * Priority constant for the println method; use Log.i.
     */
    public static final int INFO = 4;

    /**
     * Priority constant for the println method; use Log.w.
     */
    public static final int WARN = 5;

    /**
     * Priority constant for the println method; use Log.e.
     */
    public static final int ERROR = 6;

    /**
     * Priority constant for the println method.
     */
    public static final int ASSERT = 7;
2. Logcat simple tutorial

STEP 1: TAG, ie logs labels, we recommend using the class name + XX, it is easy to find places to print the log, it will not be confused and logging system

private static final String TAG = "MainActivityLog";

Then call Log method where needed to write the log, give chestnuts

Log.d(TAG,"onCreate()方法被调用");

Step Two: Click the drawing position of the box, the default option is the arrow pointing to the
Here Insert Picture Description
third step: open the drop-down menu, select Edit filter Configuration options
Here Insert Picture Description
Step 4: Click +, fill in the Tag value is just the first step in setting that, selection ok
Here Insert Picture Description
last: drop-down box to select the filter just your own set, Logcat will only print the log what you've set up
Here Insert Picture Description

Published 34 original articles · won praise 65 · views 3717

Guess you like

Origin blog.csdn.net/baidu_41860619/article/details/104400923