linux - printk() doesn't print in /var/log/messages -
my os ubuntu 12.04. wrote kernel module , use insmod , rmmod command there isn't in /var/log messages. how can fix problem?
/* * hello-1.c - simplest kernel module. */ #include <linux/module.h> /* needed modules */ #include <linux/kernel.h> /* needed kern_info */ int init_module(void) { printk(kern_info "hello world 1.\n"); /* * non 0 return means init_module failed; module can't loaded. */ return 0; } void cleanup_module(void) { printk(kern_info "goodbye world 1.\n"); }
check whether syslog daemon process running, since process copies printk messages kernel ring/log message buffer /var/log/messages if correct. printk messages can seen using dmesg utility/command or messages in /var/log/messages. if correct loglevel set printk messages displayed on console right away, no need use dmesg or no need check in /var/log/messages. printk debug messages can part of /var/log/syslog.
Comments
Post a Comment