Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between logcat vs. dmesg?

What log source is used by logcat (with default settings: adb shell logcat). Are dmesg logs included in logcat's output? If not, what's the difference between dmesg logs and logcat logs?

like image 256
jgro Avatar asked Nov 04 '12 20:11

jgro


1 Answers

According to the source code https://github.com/android/platform_system_core/blob/master/liblog/logd_write.c Log.d(String tag, String message) writes directly to /dev/log/main.

You can write there like this adb shell echo "Hello world" >> /dev/log/main

But dmesg prints the contents of the kernel's ring buffer. So dmesg will print only what system writes to kernel log, logcat will output only android app's logs.

like image 150
vasart Avatar answered Nov 10 '22 07:11

vasart