[Solved] Why printk doesn’t print message in kernel log(dmesg)
The kernel log ring buffer behaves as if it were line-buffered, as it can be seen in the implementation:
-
in
vprintk_emityou can see how it marks a buffer to be flushed/buffered based on the existence of a trailing newline -
in
log_outputyou can see the actual code which takes care of flushing or buffering the message
As it is evident, your messages do not contain trailing newlines. Had you deleted the trailing space, you would see the messages in the kernel log after they had been flushed in the printk call(s).
Read more here: Source link
