Taking logcat and kernel logs simultaneously

折月煮酒 提交于 2020-01-01 17:07:10

问题


I am trying to take logs (logcat and kmsg) via the following command

"logcat -v time -f /dev/kmsg | cat /proc/"

However I am not sure, where the log file is stored, and what will be its name. How do I identify it


回答1:


OK, here are the results of a quick Google search:

  • Android Logging System
  • How to get kernel messages from Android?

What I got from those links are:

  1. The last part of your command should actually be cat /proc/kmsg
  2. logcat -v time -f /dev/kmsg writes logcat outputs to kernel message buffer

So,

logcat -v time -f /dev/kmsg | cat /proc/kmsg

will output both logcat and kernel logs to stdout (whatever it is). Probably, you may write the output to a file as follows:

logcat -v time -f /dev/kmsg | cat /proc/kmsg > /sdcard/log.txt

The above worked from adb shell prompt on a rooted Android 4.4.2 device.

Hope this helps.




回答2:


Just execute the following line and that would show the kernel messages on to the logcat

$ adb shell

$ logwrapper cat /dev/kmsg &

$ logcat




回答3:


Here is a quick way:

adb shell

logcat | cat /proc/kmsg



回答4:


Here is logcat option for getting kernel logs too

adb logcat -b all


来源:https://stackoverflow.com/questions/22652605/taking-logcat-and-kernel-logs-simultaneously

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!