简体   繁体   中英

Difference between log methods

I am new in android and i print log-cat using:

Log.w("Tag", "String text");

and log text print but after searching for a time i find some more way to print logcat like:

Log.v() 
Log.d()

and now i am confuse in these methods.

Which is the best method for print log-cat and how may method for print lagcat and also what is the main difference between them?

commonly used Log methods are five:

Log.v () VERBOSE

Log.d () DEBUG

Log.i () INFO

Log.w () WARN

Log.e () ERROR

1: Log.v - debugging color black , and any messages will be output, where v represents the verbose verbose mean, usually is Log.v ("", "");

2: Log.d - the output color is blue , the only output debug debugging meaning, but he would output the upper filter up through of DDMS Logcat label to select.

3: Log.i - output color is green , general tips, news information, it does not the output Log.v Log.d information, but will display the information of i, w and e

4: Log.w - mean orange , can be seen as a warning The warning, in general we need to optimize the Android code, and will output it after Log.e.

5: Log.e - is red , you can think of error error here only to show the red error message, these errors we need careful analysis.

For more information:

http://developer.android.com/guide/developing/debugging/debugging-log.html

The various single-letter methods indicate the severity of the log message. Subsequently, you can filter log messages based on both the tag and the severity, and prevent lesser-severity messages from being shown in your released application (for example).

For more information:

http://developer.android.com/guide/developing/debugging/debugging-log.html

There is a difference in severity;

Log.e() will simply log an error to the log with priority ERROR.

Generally, use the Log.v() Log.d() Log.i() Log.w() and Log.e() methods.

The order in terms of verbosity, from least to most is ERROR, WARN, INFO, DEBUG, VERBOSE. Verbose should never be compiled into an application except during development. Debug logs are compiled in but stripped at runtime. Error, warning and info logs are always kept. ERROR, WARN, INFO, DEBUG, VERBOSE. Verbose should never be compiled into an application except during development. Debug logs are compiled in but stripped at runtime. Error, warning and info logs are always kept.

int ASSERT Priority constant for the println method.
int DEBUG Priority constant for the println method; use Log.d.
int ERROR Priority constant for the println method; use Log.e.
int INFO Priority constant for the println method; use Log.i.
int VERBOSE Priority constant for the println method; use Log.v.
int WARN Priority constant for the println method; use Log.w.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM