I have put some printk
statement inside Linux kernel like this
printk(KERN_DEBUG " Hello from Kernel ");
and I am interested to record output of this command while running a.out
application , like:
cp /var/log/dmesg oldLog.txt
./a.out
cp /var/log/dmesg newLog.txt
diff oldLog.txt newLog.txt
But it seems this method does not work. Both newLog.txt and oldLog.txt are kind of the same. However, I can observe "Hello from Kernel"
in dmesg
command output. Are you aware of an easy way to capture the log like this ?
My second question is about loglevel. I used KERN_DEBUG
in the printk
statement but even if I set echo 1 > /proc/sys/kernel/printk
it still print Hello from kernel
in the dmesg
command output.