In the code debugging, the log information is essential, about the use of log information, next, a brief description of the small:
There are several types of logs: Verbose: Literally, Verbose is verbose, verbose, so the content of Verbose log information output is more comprehensive
Debug log information
Info log Information
Warn log information
Error log information
Assert log information
There are many kinds of output of the log, first of all, the use of log output logs, the code is as follows:
public class LogTestDemo1 extends Androidtestcase {
private static String Loginfo = "Loginfo";
private static String Logdebug = "Logdebug";
private static String logwarning = "logwarning";
private static String LOGERROR = "LOGERROR";
private static String Logverbose = "Logverbose";
private static String LOGWTF = "LOGWTF";
public void Test1 () throws exception{
LOG.I (Loginfo, "This is a Info log"); Output Info Log information
LOG.D (Logdebug, "This is a Debug log"); Output Debug Log information
LOG.E (LOGERROR, "This is a Error log"); Output error log information
LOG.V (Logverbose, "This is a Verbose log"); Output verbose log information
LOG.W (logwarning, "This is a Warning log"); Output warning information
LOG.WTF (LOGWTF, "What's a teriable log");//Output A What a terrible failure log information
}
}
After running this test code, the following is shown in Logcat:
The second output log information is in the form: using the System.out output:
System.out.println ("This is a Log test");
Shown in Logcat as:
The default is info level, labeled System.out
The third type: using System.err output
System.err.println ("This is a Log test");
Shown in Logcat as:
The default is warn level, labeled System.err
There are three ways to output log information, but the first is the recommended way to use log.