androidlogcatdmesg

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?


Solution

  • 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.