pr_info not printing message in /var/log/messages
I was looking at http://stackoverflow.com/questions/8090944/printk-not-working-for-kernel-deb... Initially it was - # cat /proc/sys/kernel/printk 7 4 1 7 Then i did - # echo "7 7" > /proc/sys/kernel/printk # cat /proc/sys/kernel/printk 7 7 1 7 # sysctl -a | grep printk kernel.printk = 7 7 1 7 kernel.printk_delay = 0 kernel.printk_ratelimit = 5 kernel.printk_ratelimit_burst = 10 still I the pr_info ("hello, world"); message doesn't get printed to /var/log/messages. please give me some hints as to resolve this issue. -- Shraddha
I think try with ]# cat /proc/sys/kernel/printk 4 4 1 7 Regards Abhishek On Tue, Feb 5, 2013 at 8:28 PM, Shraddha Kamat <sh2008ka@gmail.com> wrote:
I was looking at
http://stackoverflow.com/questions/8090944/printk-not-working-for-kernel-deb...
Initially it was - # cat /proc/sys/kernel/printk 7 4 1 7
Then i did -
# echo "7 7" > /proc/sys/kernel/printk # cat /proc/sys/kernel/printk 7 7 1 7
# sysctl -a | grep printk kernel.printk = 7 7 1 7 kernel.printk_delay = 0 kernel.printk_ratelimit = 5 kernel.printk_ratelimit_burst = 10
still I the pr_info ("hello, world"); message doesn't get printed to /var/log/messages.
please give me some hints as to resolve this issue.
-- Shraddha
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Thanks & Regards ============X============= Abhishek Gupta. Grad student. Dept of Computer Science and Information Systems. Birla Institute of Technoogy & Science, Pilani. India. ============X===============
On Tue, 05 Feb 2013 20:28:34 +0530, Shraddha Kamat said:
still I the pr_info ("hello, world"); message doesn't get printed to /var/log/messages.
please give me some hints as to resolve this issue.
The /proc/sys/kernel/printk control basically controls what printk stuff gets printed to /dev/console. What goes in /var/log/messages will depend on what syslog server you're running, and what you have coded in /etc/syslog.conf (or equivalent for rsyslogd or syslog-ng or whatever you're running).
in fact, i've been always wondering what is the relationship between dmesg and /var/log/message. they diverse a lot... jimmy
On Wed, 06 Feb 2013 04:43:20 +0800, Jimmy Pan said:
in fact, i've been always wondering what is the relationship between dmesg and /var/log/message. they diverse a lot...
What ends up in /var/log/message is some subset (possibly 100%, possibly 0%) of what's in dmesg. Where your syslog daemon routes stuff is a local config issue - if your syslogd supports it, there's no reason not to dump the iptables messages in to /var/log/firewall and the rest of it in /var/log/kernel, or any other policy that makes sense for the sysadmin....
On Tue, 2013-02-05 at 16:18 -0500, Valdis.Kletnieks@vt.edu wrote:
On Wed, 06 Feb 2013 04:43:20 +0800, Jimmy Pan said:
in fact, i've been always wondering what is the relationship between dmesg and /var/log/message. they diverse a lot... dmesg is provided by kernel using cat /proc/kmsg.
/proc/kmsg is like any other linux file which supports below file operations: from /kernel/printk.c const struct file_operations kmsg_fops = { .open = devkmsg_open, .read = devkmsg_read, .aio_write = devkmsg_writev, .llseek = devkmsg_llseek, .poll = devkmsg_poll, .release = devkmsg_release, }; printk dumps it's output in the ring buffer whose size is set using defconfig CONFIG_LOG_BUF_SHIFT(if 16 => then ring buffer size is 64KB, and for 17 => 128KB). This ring buffer is the source for syslog and klogd daemon logs.How it extracts the buffer depends on the configuration of these deamons. Call stack: printk vprintk_emit log_store write to log_buf log_from_idx used by /proc/kmsg to read the buffer sylog uses ioctl to work on ring buffers: case SYSLOG_ACTION_CLOSE: /* Close log */ case SYSLOG_ACTION_OPEN: /* Open log */ case SYSLOG_ACTION_READ: /* Read from log */ case SYSLOG_ACTION_READ_CLEAR: case SYSLOG_ACTION_READ_ALL: case SYSLOG_ACTION_CLEAR: case SYSLOG_ACTION_CONSOLE_OFF: case SYSLOG_ACTION_CONSOLE_ON: case SYSLOG_ACTION_CONSOLE_LEVEL: case SYSLOG_ACTION_SIZE_UNREAD: case SYSLOG_ACTION_SIZE_BUFFER: Quoting from http://askubuntu.com/questions/26237/difference-between-var-log-messages-var... Syslog is a standard logging facility. It collects messages of various programs and services including the kernel, and stores them, depending on setup, in a bunch of log files typically under /var/log. There are also possibilities to send the messages to another host over network, to a serial console, to a database table, etc. According to my /etc/syslog.conf, default /var/log/kern.log captures only the kernel's messages of any loglevel; i.e. the output of dmesg. /var/log/messages instead aims at storing valuable, non-debug and non-critical messages. This log should be considered the "general system activity" log. /var/log/syslog in turn logs everything, except auth related messages. Other insteresting standard logs managed by syslog are /var/log/auth.log, /var/log/mail.log. Regarding your question: if you need solely kernel messages log, use the kern.log or call dmesg.
What ends up in /var/log/message is some subset (possibly 100%, possibly 0%) of what's in dmesg. Where your syslog daemon routes stuff is a local config issue - if your syslogd supports it, there's no reason not to dump the iptables messages in to /var/log/firewall and the rest of it in /var/log/kernel, or any other policy that makes sense for the sysadmin.... _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Thu, 07 Feb 2013 23:20:27 +0530, anish kumar said:
Other insteresting standard logs managed by syslog are /var/log/auth.log, /var/log/mail.log.
Other interesting *common* logs, as shipped pre-configured by some distros. They are hardly a "standard" (unless the definitions of these managed to sneak into Posix or the LSB or similar while I wasn't looking).
participants (5)
-
Abhishek Gupta -
anish kumar -
Jimmy Pan -
Shraddha Kamat -
Valdis.Kletnieks@vt.edu