What is the difference between logcat vs. dmesg?

jgro picture jgro · Nov 4, 2012 · Viewed 24.4k times · Source

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?

Answer

vasart picture vasart · Nov 4, 2012

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.