美文网首页
Android系统稳定性Log分析

Android系统稳定性Log分析

作者: momxmo | 来源:发表于2021-06-29 11:47 被阅读0次

前言:
在平时我们开发工作中,经常会遇到系统死机、黑屏卡死、冻屏等各种莫名其妙的问题,这对于我们系统开发工作者是一大挑战,除了我们需要有处理问题经验和能力外,我们需要借助Google提供的各种log分析,提高我们定位处理问题的能力!


各种常见问题:

1、应用冻结/崩溃

App这里问题比较常见,表现的现象为ANR、Crash、OOM等情况,可以通过Log日志分析:

1.捕获通用日志
logcat log (main, system, event, radio)

2.抓取内核日志(Dmesg/kernel logs)
adb shell  " cat  /proc/kmsg "  或者 adb shell dmesg

3.获取系统ANR日志(Trace file /data/anr) 
adb pull /data/anr/  .\anr

4.获取系统墓碑日志(tombstones )
adb pull /data/tombstones  .\tombstones

5.过滤运行时异常和DEBUG异常
adb logcat  -s AndroidRuntime,DEBUG > crash.txt
2、系统重启

这属于系统的稳定系,出现在system server死锁问题,然后Android的WatchDog看门狗检测到了,然后重启Android相关进程导致,可以通过以下手段捕获奔溃日志:

1.捕获通用日志
logcat log (main, system, event, radio)

2.抓取内核日志(Dmesg/kernel logs)
adb shell  " cat  /proc/kmsg "  或者 adb shell dmesg

3.抓取bugreport信息(该信息是Android为了方便开发人员分析整个系统平台和某个app在运行一段时间之内的所有信息,专门开发了bugreport工具)
adb shell bugreport  > bugreport.txt

4.抓取dumpstate信息(dumpstate类似于dumpsys都是android提供给开发者的帮助了解系统运行状态的利器)
adb shell dumpstate > dumpstate.txt

5.抓取dumpsate(dumpsys都是android提供给开发者的帮助了解系统运行状态的利器)
adb shell dumpsys > dumpsys.txt

6.抓取Binder传输日志
adb pull /d/binder/ .\binder

7.获取系统ANR日志(Trace file /data/anr) 
adb pull /data/anr/  .\anr

8.获取系统墓碑日志(tombstones )
adb pull /data/tombstones  .\tombstones
3、手机黑屏(Black screen)

终端黑屏(Black screen)这种系统稳定性问题,一般出现问题时,此时power按键一般能用,可以通过adb shell getevent查看到input事件信息,可以通过如下手段捕获崩溃日志:

1.捕获通用日志
logcat log (main, system, event, radio)

2.抓取内核日志(Dmesg/kernel logs)
adb shell  " cat  /proc/kmsg "  或者 adb shell dmesg

3.抓取bugreport信息(该信息是Android为了方便开发人员分析整个系统平台和某个app在运行一段时间之内的所有信息,专门开发了bugreport工具)
adb shell bugreport  > bugreport.txt

4.抓取dumpstate信息(dumpstate类似于dumpsys都是android提供给开发者的帮助了解系统运行状态的利器)
adb shell dumpstate > dumpstate.txt

5.抓取dumpsate(dumpsys都是android提供给开发者的帮助了解系统运行状态的利器)
adb shell dumpsys > dumpsys.txt

6.抓取Binder传输日志
adb pull /d/binder/ .\binder

7.获取系统ANR日志(Trace file /data/anr) 
adb pull /data/anr/  .\anr

8.获取系统墓碑日志(tombstones )
adb pull /data/tombstones  .\tombstones

9.获取meminfo日志(Meminfo log) 
adb shell cat proc/meminfo >meminfo.txt 

10.获取Procrank信息 (Procrank log) 
adb shell procrank >procrank.txt 

11 获取top信息日志(Top log) 
adb shell top -m 10  >top.txt 

12.Add below information: 
•Adb workable or not, ANR or not 
•CTP workable or not
 -> touch screen and observe the output of
 "adb shell getevent". 
•Display driver workable or not
 -> Use the screencast to see
 if the screen can be displayed 
•Power key/volume key work or not? 
Menu/back/home key work or not? 

13 .查看kernel的线程函数栈
adb shell "echo t > /proc/sysrq-trigger"
adb shell "cat /proc/kmsg" > ./kmsg_trigger.txt
4、系统卡死/屏幕卡死(System Freeze/ Touch Panel Freeze)

这是Android系统稳定性里面最严重的,此时一般按Power按键、菜单键等都是失效的,此时可以通过adb shell getevent查看不到到input事件信息,看不到任何信息了,我们这是可以通过如下手段捕获日志:

1.捕获通用日志
logcat log (main, system, event, radio)

2.抓取内核日志(Dmesg/kernel logs)
adb shell  " cat  /proc/kmsg "  或者 adb shell dmesg

3.抓取bugreport信息(该信息是Android为了方便开发人员分析整个系统平台和某个app在运行一段时间之内的所有信息,专门开发了bugreport工具)
adb shell bugreport  > bugreport.txt

4.抓取dumpstate信息(dumpstate类似于dumpsys都是android提供给开发者的帮助了解系统运行状态的利器)
adb shell dumpstate > dumpstate.txt

5.抓取dumpsate(dumpsys都是android提供给开发者的帮助了解系统运行状态的利器)
adb shell dumpsys > dumpsys.txt

6.抓取Binder传输日志
adb pull /d/binder/ .\binder

7.获取系统ANR日志(Trace file /data/anr) 
adb pull /data/anr/  .\anr

8.获取系统墓碑日志(tombstones )
adb pull /data/tombstones  .\tombstones

9.获取meminfo日志(Meminfo log) 
adb shell cat proc/meminfo >meminfo.txt 

10.获取Procrank信息 (Procrank log) 
adb shell procrank >procrank.txt 

11 获取top信息日志(Top log) 
adb shell top -m 10  >top.txt 

12.Add below information: 
•Adb workable or not, ANR or not 
•CTP workable or not
 -> touch screen and observe the output of
 "adb shell getevent". 
•Display driver workable or not
 -> Use the screencast to see
 if the screen can be displayed 
•Power key/volume key work or not? 
Menu/back/home key work or not? 

13 .查看kernel的线程函数栈
adb shell "echo t > /proc/sysrq-trigger"
adb shell "cat /proc/kmsg" > ./kmsg_trigger.txt

14.抓取窗口信息 (Dumpsys window log)
adb shell dumpsys window > dump_window.txt

15.抓取可以 event信息(Key events log) 
adb shell getevent -rtl /dev/input/event0 按键事件

结语

以上Log分析是针对不同的Android系统稳定性,提供抓日志方法。有了相关日志信息我们才能进一步进行具体日志分析,分析日志需要考研开发人员的硬实力了,有什么问题欢迎留言探讨!

拓展内容:
BugReport分析工具:
google开源
ChkBugReport开源

另一种问题定位分析方式,更精确:Android 系统全局Bug日志监听

相关文章

  • Android系统稳定性Log分析

    前言:在平时我们开发工作中,经常会遇到系统死机、黑屏卡死、冻屏等各种莫名其妙的问题,这对于我们系统开发工作者是一大...

  • Android 系统稳定性分析

    分析Android问题时,经常会遇到一些稳定性问题。什么是稳定性问题呢,我归结有以下特点, 非必现问题,或没有找到...

  • Android 系统全局Bug日志监听

    前言做系统开发一两年时间了,终于能定下心来去好好研究Android系统异常记录原理,方便我们在后面做系统稳定性分析...

  • Android之log

    Log 在Android中的地位非常重要,要是作为一个android程序员不能过分析log这关,算是android...

  • android log分析

    date: 2019-12-19email: panzh8266@163.comgithub: https://g...

  • Android系统压力测试开源工具推荐-AndroidStres

    下载 源码 这是一个Android系统压力测试APP,用于验证系统主要模块的稳定性。适应于Android硬件制...

  • Android系统稳定性简述

    一. 稳定性简述 Android系统稳定性对于用户体验至关重要. 对于稳定性问题从表现来看有: 死机重启, 自动关...

  • Android系统稳定性简述

    一. 稳定性简述 Android系统稳定性对于用户体验至关重要. 对于稳定性问题从表现来看有: 死机重启, 自动关...

  • Logcat使用

    Logcat命令介绍 Android Log系统 Logcat介绍 logcat是android中的一个命令行工具...

  • android系统稳定性-内存问题分析总结

    前言 软件版本在拷机(长稳)阶段最容易系统稳定性问题,而且任何卡死/卡顿/崩溃/重启等现场都可能是内存异常导致,从...

网友评论

      本文标题:Android系统稳定性Log分析

      本文链接:https://www.haomeiwen.com/subject/hwuhultx.html