1 / 13

Logcat 的分析及使用方法

Logcat 的分析及使用方法. Android logcat 的分析及使用方法. 简介 命令格式 实现细节 常用方法 注意事项. 命令格式. Usage: logcat [options] [filterspecs] filterspecs are a series of <tag>[:priority]. 实现细节. 常用方法. 傻瓜方式 logcat Logcat –s <filter> 尽量避免使用 非现场 debug ,请一定不要使用这种方法打印 trace. 常用方法. 提供给研发分析 logcat –v threadtime

kaiser
Télécharger la présentation

Logcat 的分析及使用方法

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Logcat的分析及使用方法

  2. Android logcat的分析及使用方法 • 简介 • 命令格式 • 实现细节 • 常用方法 • 注意事项

  3. 命令格式 • Usage: logcat [options] [filterspecs] filterspecs are a series of <tag>[:priority]

  4. 实现细节

  5. 常用方法 • 傻瓜方式 • logcat • Logcat –s <filter> • 尽量避免使用 • 非现场debug,请一定不要使用这种方法打印trace

  6. 常用方法 • 提供给研发分析 • logcat –v threadtime • logcat –v threadtime –b events • logcat –v threadtime –b radio

  7. 常用方法 • 只看某几个tag的trace • Logcat –s EGL dalvikvm • Logcat –s EGL:W dalvikvm:E

  8. 注意事项 • 尽量避免在串口中使用 • 串口输出速度较慢,如果trace过多,输出的速度可能会跟不上输入 • 串口输出对系统影响大 • 中断形式 • 中断时间较长 (ms级别) • Trace performance可能会很不准 • 由于对系统冲击较大,可能造成应用行为异常,误报bug

  9. 注意事项 • Log的输出顺序,有可能和实际不一致 • 默认输出的是main和system两个buffer中的trace

  10. 注意事项 • 避免冗余的Trace信息 • Logcat自带了 时间、进程、线程信息 • 无需额外加trace打印

  11. Native代码中,避免LOGX无法输出trace • #undef LOG • #include <cutils/log.h> • LOGD(xxxxx)

  12. 注意事项 • 熟悉一些常见的系统信息 • 比如开机过程中的输出 • 记住常见信息,在异常时可以帮助快速定位

  13. Thanks!

More Related