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
-M <1,0>        Set enable copy(Move) the log to oms_log_path
-v <format>     Sets the log print format, where <format> is one of:

brief process tag thread raw time threadtime long

-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
                  ('main' (default), 'radio', 'events')
-B              output the log in binary

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_TAGS.
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"

示例:

    1. 看radio log
      logcat -b radio

      I/RILC    (   46): 39 0d 0a
      I/RILC    (   46): AT[0]< +ECIND: 1,16,99
      I/RILC    (   46): AT[0]< +ECSQ: 16,99
      I/RILC    (   46): <<<< pCh[0]...
      I/RILC    (   46): 0d 0a 2b 45 43 49 4e 44 3a 20 31 2c 31 37 2c 39 39 0d 0a 0d 0a 2b 45 43 53 51 3a 20 31 37 2c 39
      I/RILC    (   46): 39 0d 0a
      I/RILC    (   46): AT[0]< +ECIND: 1,17,99
      I/RILC    (   46): AT[0]< +ECSQ: 17,99

    2. 查看warning以上的log
      logcat *:w

      E/SensorManager( 102): smjni------jni data_open
      E/        (   49): b433 6155
      E/        (   49): b433 6157
      E/gralloc ( 102): [unregister] handle 0x2debd0 still lock
      W/BatteryService( 102): get battery health[0] 'Charging'
      W/BatteryService( 102): get battery health='Good'
      W/BatteryService( 102): get battery health[0] 'Charging'
      W/BatteryService( 102): get battery health='Good'

    3. 过滤查看dalvikvm的log
      logcat -s dalvikvm 或者 logcat dalvikvm *:s

      D/dalvikvm( 257): GC freed 1191 objects / 343344 bytes in 65ms
      D/dalvikvm( 257): GC freed 1191 objects / 343400 bytes in 64ms
      D/dalvikvm( 257): GC freed 1191 objects / 343368 bytes in 65ms
      D/dalvikvm( 257): GC freed 1191 objects / 343416 bytes in 70ms
      D/dalvikvm( 257): GC freed 1191 objects / 343384 bytes in 64ms

      备注:logcat的过滤方式有点儿怪异,并不是直接指定要过滤的tag并指定priority就行,必须要设定所有的为silent,在此基础上设置的tag过滤才成功。
      所以,logcat appname:v 是不能成功过滤log的。

    4. 过滤多个app 的log
      logcat -s dalvikvm vold

      D/vold    (   43): door_sock=10
      D/vold    (   43): fw_sock=7
      D/vold    (   43): uevent_sock=6
      D/dalvikvm( 257): GC freed 1191 objects / 343384 bytes in 76ms
      D/dalvikvm( 257): GC freed 1191 objects / 343368 bytes in 81ms
      D/dalvikvm( 257): GC freed 1191 objects / 343400 bytes in 64ms
      D/vold    (   43): select result=1
    5. log保存到文件
      logcat > 1.txt (">"是windows用的数据流导向符号)

      尝试用-f选项,结果报错。
      logcat -f 1.txt
      couldn't open output file: Read-only file system

Logcat过滤及常见用法整理的更多相关文章

  1. DevExpress 控件 GridControl常见用法

    刚接触DevExpress第三方控件,把GridControl的常见用法整理一下,以供参考: 说明: gcTest   GridControl gvText    GridView //隐藏最上面的G ...

  2. GridControl常见用法【转】

    刚接触DevExpress第三方控件,把GridControl的常见用法整理一下,以供参考: 说明: gcTest   GridControl gvText    GridView //隐藏最上面的G ...

  3. Linux中find常见用法

    Linux中find常见用法示例 ·find   path   -option   [   -print ]   [ -exec   -ok   command ]   {} \; find命令的参数 ...

  4. Guava中Predicate的常见用法

    Guava中Predicate的常见用法 1.  Predicate基本用法 guava提供了许多利用Functions和Predicates来操作Collections的工具,一般在 Iterabl ...

  5. find常见用法

    Linux中find常见用法示例 ·find   path   -option   [   -print ]   [ -exec   -ok   command ]   {} \; find命令的参数 ...

  6. [转]Linux中find常见用法示例

    Linux中find常见用法示例[转]·find   path   -option   [   -print ]   [ -exec   -ok   command ]   {} \;find命令的参 ...

  7. layui(二)——layer组件常见用法总结

    layer是layui的代表作,功能十分强大,为方便以后快速配置这里对其常见用法做了简单总结 一.常用调用方式 //1.普通消息:alert(content,[options],[yesCallBac ...

  8. #ifndef#define#endif的用法(整理)

    [转] #ifndef#define#endif的用法(整理)    原作者:icwk  文件中的#ifndef 头件的中的#ifndef,这是一个很关键的东西.比如你有两个C文件,这两个C文件都in ...

  9. Moment.js常见用法总结

    Moment.js常见用法总结 Moment.js是一个轻量级的JavaScript时间库,它方便了日常开发中对时间的操作,提高了开发效率. ​ 日常开发中,通常会对时间进行下面这几个操作:比如获取时 ...

随机推荐

  1. toggle的使用心得

    点击同一个标签可以实现不同效果 或者几个效果 以前一般都是if 判断的 逻辑还有判断比较繁琐 看啦手册后 发现这个功能可以不用判断的自动循环点击事件 比以前的简单好用 主要用法:$("td& ...

  2. Html的Table与Echart的饼图实现联动效果

    功能描述: 单击Table中的某个单元格,Echart的饼图加载相关的数据,鼠标悬停在Echarts饼图中的某一块中,Table显示与Echarts饼图相关的数据. 例:楼宇经济概要显示每一个季度所有 ...

  3. sql语句的group by与having子句

    准备数据: DROP TABLE IF EXISTS `t_player`; CREATE TABLE `t_player` ( `player_id` int(11) NOT NULL AUTO_I ...

  4. 【第四篇】androidEventbus源代码阅读和分析

    1,分析androidEventbus的注册源代码: 我们在使用androidEventbus的第一步是注册eventbus,如下代码: EventBus.getDefault().register( ...

  5. php项目第三季

    1.百度浏览器路径写相对路径 2.svn--setting中两个勾去掉,第二页一个勾打上.工程上右击update是更新,commit是提交. 3.Deprecated: mysql_connect() ...

  6. c语言-猜数字游戏

    #include <stdio.h> #include <stdlib.h> int top(); int input(); void main() { ; int numbe ...

  7. apt-get 依赖修复

    apt-get cleanapt-get update apt-get -f install dpkg --configure -a

  8. hdu_2955_Robberies(01背包)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=2955 题意:给一个概率p和n个银行,每个银行有一些钱和被抓的概率,问在满足被抓的概率在p以下,抢到的最 ...

  9. nodejs 命令篇

    1.npm init // 生成package.json 2.npm install --save-dev gulp-jslint // 安装gulp-jslint模块,并把模块名和版本保存到pack ...

  10. ECShop - 数据库操作类

    ECShop v2.7.2没有使用一些开源的数据库操作类,比如adodb或者PEAR,而是封装了自己的实现.这样做的好处是实现非常轻量,只有一个文件,27Kb,大大减小了分发包的文件大小.另外,当网站 ...