Android 同时获取 logcat 和内核日志
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22652605/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Taking logcat and kernel logs simultaneously
提问by manugupt1
I am trying to take logs (logcat and kmsg) via the following command
我正在尝试通过以下命令获取日志(logcat 和 kmsg)
"logcat -v time -f /dev/kmsg | cat /proc/"
“logcat -v 时间 -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
但是我不确定日志文件的存储位置以及它的名称。我如何识别它
回答by ozbek
OK, here are the results of a quick Google search:
好的,以下是快速 Google 搜索的结果:
What I got from those links are:
我从这些链接中得到的是:
- The last part of your command should actually be
cat /proc/kmsg
logcat -v time -f /dev/kmsg
writes logcat outputs to kernel message buffer
- 命令的最后一部分实际上应该是
cat /proc/kmsg
logcat -v time -f /dev/kmsg
将 logcat 输出写入内核消息缓冲区
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 和内核日志输出到stdout
(无论它是什么)。可能,您可以将输出写入文件,如下所示:
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.
以上工作adb shell
在有根的 Android 4.4.2 设备上从提示开始。
Hope this helps.
希望这可以帮助。
回答by Pandurang Kale
Just execute the following line and that would show the kernel messages on to the logcat
只需执行以下行,即可将内核消息显示到 logcat
$ adb shell
$亚行外壳
$ logwrapper cat /dev/kmsg &
$ logwrapper cat /dev/kmsg &
$ logcat
$ logcat
回答by vishwanath patil
Here is logcat option for getting kernel logs too
这里也是获取内核日志的 logcat 选项
adb logcat -b all
回答by Chaneswar
Using below commands: start cmd.exe /c "adb shell cat /dev/kmsg > kmsg.txt" start cmd.exe /c "adb logcat -v threadtime > logcat.txt"
使用以下命令: start cmd.exe /c "adb shell cat /dev/kmsg > kmsg.txt" start cmd.exe /c "adb logcat -v threadtime > logcat.txt"
回答by Colin
Here is a quick way:
这是一个快速的方法:
adb shell
logcat | cat /proc/kmsg