Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Taking logcat and kernel logs simultaneously

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

like image 365
manugupt1 Avatar asked Mar 26 '14 05:03

manugupt1


People also ask

How do I monitor kernel logs?

You can also view logs via dmesg, which prints the kernel ring buffer and sends you to the end of the file. From there, you can use the command dmesg | less to scroll through the output. If you want to view log entries for the user facility, you need to issue the command dmesg –facility=user.

What is Logcat buffer?

Logcat is a command-line tool that dumps a log of system messages when the device throws an error and sends messages that you have written from your app with the Log class. This page is about the command-line logcat tool, but you can also view log messages from the Logcat window in Android Studio.


2 Answers

Here is logcat option for getting kernel logs too

adb logcat -b all
like image 29
vishwanath patil Avatar answered Sep 28 '22 15:09

vishwanath patil


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.

like image 72
ozbek Avatar answered Sep 28 '22 14:09

ozbek