原链接:http://www.elexcon.com/news/55195.html
Android中Log的输出有如下几种:
l Log.v(String tag, String msg); //VERBOSE
l Log.d(String tag, String msg); //DEBUG
l Log.i(String tag, String msg); //INFO
l Log.w(String tag, String msg); //WARN
l Log.e(String tag, String msg); //ERROR
以上log的级别依次升高,VERBOSE DEBUG信息应当只存在于开发中,INFO,WARN,ERROR这三种log将出现在发布版本中。
对于JAVA类中,可以声明一个字符串常量TAG,Logcat可以根据他来区分不同的log,例如在 WindowsManagerService.java的类中,定义如下所示:static final Sting TAG = "WindowManager",需要打log的地方:
Log.v(TAG, "Figuring out where to add app window" + client.asBinder() + "(token=" + token + ")");
logcat使用方法如下所示:
logcat [options] [filterspecs]
option "-s" 用来设置过滤器,格式是这样的 < tag >[:priority]
其中 < tag > 表示log的component, tag (或者使用 * 表示所有) ,priority如下所示:
V Verbose
D Debug
I Info
W Warn
E Error
F Fatal
S Silent
例:
logcat -s *:s 不打任何log
logcat -s WindowMnager:V < -- 打印WindowManagerService 中 Verbose 信息
如果在eclipse中查看Android log 输出,也就是logcat信息,可以 选择Windows > Show View > Other... > Android > LogCat。
附
logcat的参数说明:
Usage: logcat [options] [filterspecs]
options include:
-s Set default filter to silent.
Like specifying filterspec '*:s'
-f < filename > Log to file. Default to stdout
-r [< kbytes >] Rotate log every kbytes. (16 if unspecified). Requires -f
-n < count > Sets max number of rotated logs to < count >, default 4
-v < format > Sets the log print format, where < format > is one of:
brief process tag thread raw time long
第1页第2页
Android中Log的输出有如下几种:
l Log.v(String tag, String msg); //VERBOSE
l Log.d(String tag, String msg); //DEBUG
l Log.i(String tag, String msg); //INFO
l Log.w(String tag, String msg); //WARN
l Log.e(String tag, String msg); //ERROR
以上log的级别依次升高,VERBOSE DEBUG信息应当只存在于开发中,INFO,WARN,ERROR这三种log将出现在发布版本中。
对于JAVA类中,可以声明一个字符串常量TAG,Logcat可以根据他来区分不同的log,例如在 WindowsManagerService.java的类中,定义如下所示:static final Sting TAG = "WindowManager",需要打log的地方:
Log.v(TAG, "Figuring out where to add app window" + client.asBinder() + "(token=" + token + ")");
logcat使用方法如下所示:
logcat [options] [filterspecs]
option "-s" 用来设置过滤器,格式是这样的 < tag >[:priority]
其中 < tag > 表示log的component, tag (或者使用 * 表示所有) ,priority如下所示:
V Verbose
D Debug
I Info
W Warn
E Error
F Fatal
S Silent
例:
logcat -s *:s 不打任何log
logcat -s WindowMnager:V < -- 打印WindowManagerService 中 Verbose 信息
如果在eclipse中查看Android log 输出,也就是logcat信息,可以 选择Windows > Show View > Other... > Android > LogCat。
附
logcat的参数说明:
Usage: logcat [options] [filterspecs]
options include:
-s Set default filter to silent.
Like specifying filterspec '*:s'
-f < filename > Log to file. Default to stdout
-r [< kbytes >] Rotate log every kbytes. (16 if unspecified). Requires -f
-n < count > Sets max number of rotated logs to < count >, default 4
-v < format > Sets the log print format, where < format > is one of:
brief process tag thread raw time long
第1页第2页
接上页
-c clear (flush) the entire log and exit
-d dump the log and then exit (don't block)
-g get the size of the log's ring buffer and exit
-b < buffer > request alternate ring buffer, defaults to 'main'
filterspecs are a series of < tag >[:priority]
Where < tag > is a log component tag (or * for all) and priority is:
V Verbose
D Debug
I Info
W Warn
E Error
F Fatal
S Silent (supress all output)
'*' means '*:d' and < tag > by itself means < tag >:v
If not specified on the commandline, filterspec is set from ANDROID_LOG_TAG
If no filterspec is found, filter defaults to '*:I'
If not specified with -v, format is set from ANDROID_PRINTF_LOG or defaults to "brief"
分享到:
相关推荐
对想深入研究Android中Log的实现机制的同志有用,在此分享给大家
log4详解详解详解详解log4详解详解详解详解log4详解详解详解详解log4详解详解详解详解log4详解详解详解详解log4详解详解详解详解log4详解详解详解详解log4详解详解详解详解log4详解详解详解详解log4详解详解详解详解
Log4a is an mmap based, high-performance, highly available Android log collection framework | Log4a 是一个基于 mmap, 高性能、高可用的 Android 日志收集框架
Android中级教程之----Log图文详解
Android中Log相关流程介绍
Android显示Log信息(带行号),非常好用的Android工具类!
android自定义log日志输出工具,该工具类具有以下优点: 1 在LogUtlis方法的第一个参数中填this可以输出当前类的名称,特别是在匿名内部类使用也可以输出当前类名。 如 : LogUtils.i(this,”这是一个实用的日志...
在Android群里,经常会有人问我,Android Log是怎么用的,今天我就把从网上以及SDK里东拼西凑过来,让大家先一睹为快,希望对大家入门Android Log有一定的帮助.
android.util.Log is the most usable library of the Android. But, when the app released on the market, some important information is clearly forgotten by the developer. All logs are disabled by Debug...
示范如何在android工程中使用log4j记录日志
log4net配置详解log4net配置详解log4net配置详解log4net配置详解log4net配置详解log4net配置详解log4net配置详解log4net配置详解log4net配置详解log4net配置详解log4net配置详解log4net配置详解log4net配置详解log4...
android-log power 各包电量分析
log4j使用详解log4j使用详解log4j使用详解log4j使用详解log4j使用详解log4j使用详解log4j使用详解log4j使用详解log4j使用详解log4j使用详解log4j使用详解
android方便好用的打印log工具,可调整各种log格式,按自己的需要打印log。
有需要可以看看,动态将想要的数据通过该接口直接写到本地文件
当Android代码java层发生崩溃的时候,会将崩溃信息收集起来
Graylog client for Android devices Graylog is a rsyslog web interface based on Ruby On Rails: http://github.com/lennartkoopmann/Graylog Watch your favorite errors now mobile on your android device! :)...
Android 使用log4j所需要的jar包
在Android中引用log4j