Taking logcat and kernel logs simultaneously
Asked Answered
O

6

8

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

Organdy answered 26/3, 2014 at 5:55 Comment(0)
M
9

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

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.

Madera answered 26/3, 2014 at 8:45 Comment(0)
B
6

Here is logcat option for getting kernel logs too

adb logcat -b all
Bloodfin answered 13/10, 2019 at 10:15 Comment(0)
G
2

You have not specify the Android version you use, but if you are on 8.1 and above it is perfectly possible to have kernel messages included in logcat output with timestamps.

To have them printed in a file together, please use the following:

$adb logcat -b all -d > logcat_all.txt

And if you want to have the kernel messages with timestamps separately from the other logs use:

$adb logcat -b kernel -d > logcat_kernel.txt

-b <buffer> here specifies which buffers you want to have in the output and one of the possible buffers is kernel, which is not included by default. If you set -b all then you will have all of them together. For more details please refer to logcat --help

  -b <buffer>, --buffer=<buffer>         Request alternate ring buffer, 'main',
                  'system', 'radio', 'events', 'crash', 'default' or 'all'.
                  Multiple -b parameters or comma separated list of buffers are
                  allowed. Buffers interleaved. Default -b main,system,crash.
Goaltender answered 9/7, 2020 at 9:29 Comment(0)
B
1

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

$ adb shell

$ logwrapper cat /dev/kmsg &

$ logcat

Bullington answered 24/1, 2019 at 14:37 Comment(0)
T
0

Here is a quick way:

adb shell

logcat | cat /proc/kmsg
Toulon answered 17/12, 2018 at 1:57 Comment(0)
C
0

Using below commands: start cmd.exe /c "adb shell cat /dev/kmsg > kmsg.txt" start cmd.exe /c "adb logcat -v threadtime > logcat.txt"

Corporator answered 7/4, 2020 at 4:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.