I am trying to write some custom messages in my dmesg output. I tried:
logger "Hello"
but this does not work. It exits without error, but no "Hello" appears int the output of:
dmesg
I am using a Fedora 9, and it seems that there is no syslogd/klogd daemon running. However, all my kernel messages are succesfully written in the dmesg buffer.
Any idea?
Best Answer
dmesg
displays what is in the kernel buffer, whereaslogger
is forsyslogd
. I think if you want to print things into the kernel buffer you will need to create a driver that uses theprintk()
kernel function. If you just want it in/var/log/messages
, then with a "normal" setup I think what you have done withlogger
is already fine.The most basic example of a driver with
printk()
would be:hello.c:
Makefile:
Then:
http://tldp.org/LDP/lkmpg/2.6/html/lkmpg.html#AEN121 for more...