I wanted to take both kernel and platform logs of an Android device together. So here is a piece of code that does that.
1. connect the Android target to Windows.
2. start cmd and type
$ adb shell : this command moves user to linux shell of android device. Make sure adb location has been added to path variables in windows.
$ logcat -v time -f /dev/kmsg | cat /proc/kmsg > /data/klog_plog.txt
$logcat -v time prints the platform logs with time stamps. /dev/kmsg is a local buffer.
cat /proc/kmsg gives the kernel logs. So both platform and kernel logs are written to /data/klog_plog.txt
$ adb pull /data/klog_plog.txt > myfile.txt
it pulls the file from the Android device to local drive.
1. connect the Android target to Windows.
2. start cmd and type
$ adb shell $ logcat -v time -f /dev/kmsg | cat /proc/kmsg > /data/klog_plog.txt $ exit $ adb pull /data/klog_plog.txt > myfile.txt
$ adb shell : this command moves user to linux shell of android device. Make sure adb location has been added to path variables in windows.
$ logcat -v time -f /dev/kmsg | cat /proc/kmsg > /data/klog_plog.txt
$logcat -v time prints the platform logs with time stamps. /dev/kmsg is a local buffer.
cat /proc/kmsg gives the kernel logs. So both platform and kernel logs are written to /data/klog_plog.txt
$ adb pull /data/klog_plog.txt > myfile.txt
it pulls the file from the Android device to local drive.
Just to make it short. The following command also works well.
ReplyDelete$ adb logcat -f /dev/kmsg | adb cat /proc/kmsg > sample.txt