---Android logcat 记录日志

 
Android的日志记录信息可以通过logcat来访问.    这一个功能被整合进了ddms和adt中,  但是你可以直接通过adb命令来进行访问, 命令格式如下:

adb logcat <option> <filter>


1.  显示全部的日志信息:
     adb -e logcat    #for emulators
     adb -d logcat   #for the real devices
如果设对应的备多余一个, 那么就提示多个设备, 你可以增加通过 -s 设备系列号的方式 启动这个命令连线板子,  通过adb -d|-e devices 查看设备系列号
默认地, 日志记录模式被设置为brief.  例如, 下面显示来自线程ID 20054的信息

I/AppLog(20054) : An Infomation Log message.

现在的情况: (谁便捡一条)
06-24 06:12:06.958   213   413 D AudioHardwareTiny: close device       #目前默认的显示已经足够好了, 时间显示精确到了ms 
带与不带 -v time的情况显示如下不同:

06-24 06:20:18.619 V/EventHub(  460): awoken after wake()   
06-24 06:20:18.619   460   530 V EventHub: awoken after wake()
只带了-v threadtime, 可见默认就是这个了 
06-24 06:33:18.642   460   530 V EventHub: awoken after wake()

2.  日志严重性等级分类:
      V/D/I/W/E/F/S     V D I W E F 这6个是在程序了打印日志使用的:  ex  Log.v  ...Log.e  Log.f () 真心没有见过的了!   
     S: Silenct  关闭打印

3.  过滤器:
adb logcat RockFFPlayer:S    # 过滤掉某个TAG的打印   librkffplayer.so的媒体打印干扰当前apk的debug,  就可以用过这个命令过滤掉他们 
adb logcat RockFFPlayer:*  *:S # 就可以只是看摸个TAG的打印

4. -b的参数选择 (内部有五个ring buffer)
 默认等于  -b main,system,crash
-b all 选择全部
-b radio
-b event

5. 关于缓冲区的size
adb logcat -g -b all  

我的rk3326显示成如下这样, 感觉64K不够大了!!!!

main: ring buffer is 64Kb (57Kb consumed), max entry is 5120b, max payload is 4068b
radio: ring buffer is 64Kb (22Kb consumed), max entry is 5120b, max payload is 4068b
events: ring buffer is 64Kb (61Kb consumed), max entry is 5120b, max payload is 4068b
system: ring buffer is 64Kb (61Kb consumed), max entry is 5120b, max payload is 4068b
crash: ring buffer is 64Kb (1Kb consumed), max entry is 5120b, max payload is 4068b
kernel: ring buffer is 64Kb (0b consumed), max entry is 5120b, max payload is 4068b




 

posted on 2020-06-24 14:14  linuxdog  阅读(669)  评论(0编辑  收藏  举报

导航