Reputation: 63
The output from my device drivers which also falls in the dmesg is getting printed out on my stdout.Is there a way to prevent this?
Upvotes: 1
Views: 2674
Reputation: 9474
There are different levels of printing messages in printk().
Refer http://www.makelinux.net/ldd3/chp-4-sect-2 for different levels in printk(). Use lowest loglevel, it wont be dispalyed in stdout, but it can be viewed using dmesg
.
Upvotes: 0
Reputation: 40357
You may be able to solve your problem by dynamically adjusting the console log level.
http://tuxthink.blogspot.com/2012/07/printk-and-console-log-level.html
Suggests that you can do this by writing to a proc node:
echo "6" > /proc/sys/kernel/printk
Would set it to 6 in their example. I suspect setting it to 0 or 1 would suppress almost everything non-fatal to the system
Log entries should still be retrievable by dmesg regardless of this setting.
However, this will affect messages from all sources. If you want to change the behavior of a custom driver, consider passing it a flag which would cause program logic to suppress message generation, or generate output at less important log levels which you might set the console to ignore as above.
Upvotes: 1