title: Why printk doesn't print message in kernel log(dmesg)
body: <p>I wrote small kernel module code as mentioned below,
  I am testing it in <code>ubuntu 14.04</code></p>
  
  <pre><code>#include &lt;linux/module.h&gt; 
  #include &lt;linux/version.h&gt;
  #include &lt;linux/kernel.h&gt;
  #include &lt;linux/init.h&gt;
  
  int init_mod_func(void)
  {
      printk(KERN_INFO "My module inserted\n ");
      return 0;
  }
  
  void cleanup_mod_func(void)
  {
      printk(KERN_INFO "My module removed\n ");
  }
  
  module_init(init_mod_func);
  module_exit(cleanup_mod_func);
  
  
  MODULE_AUTHOR("Ankur");
  MODULE_DESCRIPTION("TEST MODULE");
  MODULE_LICENSE("GPL");
  </code></pre>
  
  <p>Now when I compile and insert above module using <code>insmod</code> I don't see printk message in the dmesg. However after module removal using <code>rmmod</code> I see both the printk messages.</p>
  
  <p><strong>With closure look, I found out that it is happening because of <code>space</code> after <code>\n</code> in the printk.</strong><br>
  However I don't get why it is like that.</p>
  
  <pre><code>ankur:~/temp/tmp$ 
  ankur:~/temp/tmp$ 
  ankur:~/temp/tmp$ sudo dmesg -C /dev/null
  ankur:~/temp/tmp$ 
  ankur:~/temp/tmp$ 
  ankur:~/temp/tmp$ sudo insmod testmod.ko 
  ankur:~/temp/tmp$ dmesg
  ankur:~/temp/tmp$ 
  ankur:~/temp/tmp$ sudo rmmod testmod
  ankur:~/temp/tmp$ dmesg
  [ 4062.140441] My module inserted
  [ 4062.140441]  
  [ 4073.324994] My module removed
  [ 4073.324994]
  </code></pre>