I think, that console and dmesg are not the same. console_loglevel mean sumething like text terminal. parport and so on, but dmesg is independent from this log level. You can write simple module like this:<div><br></div><div>
<div>#include <linux/module.h></div><div>#include <linux/kernel.h></div></div><div><br></div><div><div>int init_module(void) {</div><div> <span class="Apple-style-span" style="white-space: pre; ">printk(KERN_EMERG "EMERG: Hello World.\n");
        printk(KERN_ALERT "ALERT: Hello World.\n");
        printk(KERN_CRIT "CRIT: Hello World.\n");
        printk(KERN_WARNING "WARNING: Hello World.\n");
        printk(KERN_NOTICE "NOTICE: Hello World.\n");
        printk(KERN_INFO "INFO: Hello World.\n");
        printk(KERN_DEBUG "DEBUG: Hello World.\n");
        return 0;</span></div><div>}</div><div><br></div><div>void cleanup_module(void) {</div><div> printk("Bye :)");</div><div>}</div><div><br></div><div>and you see, that dmesg print everything (but /var/log/messages contained only WARNING, NOTICE and INFO levels messages, for console_loglevel = 3)</div>
<br><div class="gmail_quote">2011/3/5 Siddu <span dir="ltr"><<a href="mailto:siddu.sjce@gmail.com">siddu.sjce@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi all,<br>Hi all,<div><br></div><div>I am little stuck understanding this piece of code below and the way its been working <br><br>Question: since KERN_INFO = 6 # which is msg_log_level<br>and as per code<div><b>msg_log_level < console_loglevel</b></div>
<div><br></div><div> this line of printk is not supposed to show up in the dmesg log ? but it is showing up . Why <br><br>cat /proc/sys/kernel/printk<br>4 4 1 7<br><br>console_loglevel = 4<br><br> printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());<br>
<br><br>static void _call_console_drivers(unsigned start,<br> unsigned end, int msg_log_level)<br>{<br> if ((<b>msg_log_level < console_loglevel</b> || ignore_loglevel) &&<br> console_drivers && start != end) {<br>
if ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) {<br> /* wrapped write */<br> __call_console_drivers(start & LOG_BUF_MASK,<br> log_buf_len);<br> __call_console_drivers(0, end & LOG_BUF_MASK);<br>
} else {<br> __call_console_drivers(start, end);<br> }<br> }<br>}<br><br></div><div>Thanks for any inputs !<br>-- <br>Regards,<br>~Sid~<br><br></div></div>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br></div>