logcat调试系统
日志存放位置:/dev/log
shell@xxx:/ $ ls /dev/log -l
crw-rw-rw- root log , -- : events
crw-rw-rw- root log , -- : main
crw-rw-rw- root log , -- : radio
crw-rw-rw- root log , -- : system
提示信息的格式:等级/标签 (pid):日志内容
E/NetworkController( 934): onReceive ETHERNET_STATE_CHANGED_ACTION
等级:
V:Verbose
D: Debug
I: Info
W: Warn
E: Error
F: Fatal
S: Silent (supress all output)
标签:用来区分不同的调试信息,必须唯一。
logcat命令:
shell@xxx:/ $ logcat --help
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. ( if unspecified). Requires -f
-n <count> Sets max number of rotated logs to <count>, default
-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)
-t <count> print only the most recent <count> lines (implies -d)
-t '<time>' print most recent lines since specified time (implies -d)
-T <count> print only the most recent <count> lines (does not imply -d)
-T '<time>' print most recent lines since specified time (not imply -d)
count is pure numerical, time is 'MM-DD hh:mm:ss.mmm'
-g get the size of the log's ring buffer and exit
-b <buffer> Request alternate ring buffer, 'main', 'system', 'radio',
'events', 'crash' or 'all'. Multiple -b parameters are
allowed and results are interleaved. The default is
-b main -b system -b crash.
-B output the log in binary.
-S output statistics.
-G <size> set size of log ring buffer, may suffix with K or M.
-p print prune white and ~black list. Service is specified as
UID, UID/PID or /PID. Weighed for quicker pruning if prefix
with ~, otherwise weighed for longevity if unadorned. All
other pruning activity is oldest first. Special case ~!
represents an automatic quicker pruning for the noisiest
UID as determined by the current statistics.
-P '<list> ...' set prune white and ~black list, using same format as
printed above. Must be quoted. 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"
用法:logcat [选项] [过滤规则]
-s:过滤,输出指定标签的信息
// 打印标签为"NetworkController"的所有日志
shell@xxx:/ $ logcat -s "NetworkController"
// 打印标签为"NetworkController",并且等级为 D 的日志
shell@xxx:/ $ logcat -s "NetworkController:D"
-f <filename>:日志输出到文件,默认到标准输出
shell@xxx:/ # logcat -f /data/local/tmp/log.txt
-v <format>:设置日志的打印格式,format只能取下面中的一个,brief / process / tag / thread / raw / time / threadtime / long
brief:显示等级、标签、pid和消息,是默认格式
process:显示等级、pid和消息
tag:显示等级、标签和消息
thread:显示等级、pid、线程和消息
raw:只显示消息
time:显示时间、等级、标签、pid和消息
threadtime:显示时间、等级、pid、线程和消息
long:显示时间、等级、pid、线程和消息,但消息内容在下一行显示,而且每条日志之间空一行。
// 日志添加时间(最常用)
shell@xxx:/ # logcat -v time
-c:清空日志信息
shell@xxx:/ # logcat -c
-d:打印日志并退出,不阻塞
shell@xxx:/ # logcat -d
-t <count>:打印最近count行日志,不阻塞
shell@xxx:/ # logcat -t
-g:查看缓冲区大小并退出
shell@xxx:/ # logcat -g
main: ring buffer is 256Kb (7Kb consumed), max entry is 5120b, max payload is 4076b
system: ring buffer is 256Kb (3Kb consumed), max entry is 5120b, max payload is 4076b
crash: ring buffer is 256Kb (0b consumed), max entry is 5120b, max payload is 4076b
-b <buffer>:查看指定缓冲区,允许多个 -b 参数,并且打印是交错的
<buffer>可取:main / system / radio / event / crash / all,默认为 -b main -b system -b carsh
shell@xxx:/ # logcat -b main -b radio
-B:以二进制形式输出日志
shell@xxx:/ # logcat -B
-S:输出统计数据
shell@xxx:/ # logcat -S
-G <size>:设置日志环缓冲区的大小,可以使用K或M
shell@xxx:/ # logcat -G 256Kb
|grep:过滤日志中的字符串,与-s过滤标签不一样
shell@xxx:/ # logcat -b main -b system -b radio -v time |grep SETUP_DATA_CALL
>:输出日志到文件(windows系统)
shell@xxx:/ # logcat -b radio -v time > d:/log.txt
logcat调试系统的更多相关文章
- adb logcat调试中常用的命令介绍
Android日志系统提供了记录和查看系统调试信息的功能.日志都是从各种软件和一些系统的缓冲区中记录下来的,缓冲区可以通过 logcat 命 令来查看和使用. adb logcat 命令格式 : ad ...
- Android:基于Eclipse编译调试系统级应用源代码
一. 概要描述 在使用Eclipse导入android工程源代码以后,我们可以使用ddms调试和跟踪源代码. 本文讲述动态调试源代码和静态调试源代码的两种方法,避免build system. ...
- 如何通过logcat查看系统程序的意图
如果在logcat中不能看到系统程序启动时的意图的类名, 以打开图库(gallery)为例,可以通过在ddms中如图设置,就可以在tomcat中查看到gallery启动时的意图.
- 内存转储文件调试系统崩溃bug
百度百科:内存转储文件 内存转储是用于系统崩溃时,将内存中的数据转储保存在转储文件中,供给有关人员进行排错分析用途.而它所保存生成的文件就叫做内存转储文件. 内存转储文件也被称作虚拟内存,它是用硬盘里 ...
- Unity3D利用Logcat调试安卓
发布安卓包之后再次测试发生什么问题很难知道怎么了,比如说出现闪退等情况,可以用Logcat检测到,logcat是Android中一个命令行工具,可以用于得到程序的log信息,可以用 logcat 命令 ...
- centos7 上安装jira调试系统
安装mysql数据库 在windows上面下载 http://dev.mysql.com/downloads/mysql/ 在liunx系统上可直接wget, wget https://dev.mys ...
- ubuntu17.04 调试系统工具bcc,systamtap安装
发行版 ubuntu17.04 cat lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=17.04 DISTRIB_CODENAME=zesty DISTR ...
- 使用Windbg调试系统弹出的内存不可读错误
步骤: 1. 使用Windbg挂钩到崩溃的进程上面 2. 使用~*k列出所有线程 3. 搜索UnhandledExceptionFilter所在的线程 4. 使用~ns切换到上面崩溃所在的线程,n为线 ...
- logcat的调试 比较有用的几个命令
网上很多的logcat调试命令,但是太多的命令只会令人盐杂. (主要是adt工具带的调试功能容易死掉 每次都要重启太烦) 个人认为有一下几个常用命令: adb logcat -c 清除所有以前的日志 ...
随机推荐
- [转载]java获取word里面的文本
需求场景 开发的web办公系统如果需要处理大量的Word文档(比如有成千上万个文档),用户一定提出查找包含某些关键字的文档的需求,这就要求能够读取 word 中的文字内容,而忽略其中的文字样式.表格. ...
- MVC和EF中的 Model First 和 Code First
准备:先引入MVC和EF的dll包 *命令方法:打开工具——库程序包管理器——程序包管理器控制台,选择自己的项目 a) Install-Package EntityFramework -Ver ...
- ios 不兼容 报错NaN
function GetDateDiff(DiffTime) { //将xxxx-xx-xx的时间格式,转换为 xxxx/xx/xx的格式 Time = DiffTime.replace(/\-/g, ...
- 如何在非Spring管理的类中使用Spring加载的bean
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> < ...
- MoreEffectiveC++Item35 条款27: 要求或禁止对象产生于heap中
一 要求对象产生在heap中 阻止对象产生产生在non-heap中最简单的方法是将其构造或析构函数声明在private下,用一个public的函数去调用起构造和析构函数 class UPNumber ...
- 使用JQuery Deferred对象的then() 解决多个AJAX操作顺序依赖的问题
原文地址:http://www.2cto.com/kf/201507/424202.html 之前的文章javascript异步代码的回调地狱中提到了编写AJAX代码经常遇到的3个问题,现在我们看下如 ...
- 记一次GreenPlum性能调优
在部署了的GreenPlum集群中进行数据查询时,发现数据量一旦大了,查询一跑就中断,提示某个segment中断了连接. ERROR 58M01 "Error on receive from ...
- 跟着小程学微服务-Mock自动化系统的原理及实现
一.前言 在之前的文章 http://blog.csdn.net/u013970991/article/details/54862772 中已经介绍了"自动化Mock系统0.9版本" ...
- CSDN博客积分规则
1.博客积分规则 博客积分是CSDN对用户努力的认可和奖励,也是衡量博客水平的重要标准.博客等级也将由博客积分唯一决定.积分规则具体如下: 每发布一篇原创或者翻译文章:可获得10分: 每发布一篇转载文 ...
- 如何去访问win8系统的共享文件夹
关于共享,看过不少的贴子,觉得搞得很复杂.我看起来也很头痛.晕头转向的.其实我们作为家庭用户来说,不想搞得那么复杂,我们只要能做到能够从一台电脑访问另一台电脑的共享文件夹就可以了,这样我们就可以任意从 ...