title: Writing in separate log files
body: <p>I am trying to write different type of entries in separate log files from an application. For reason which I am trying to find out, all entries appear in all log files. What could I be doing wrong ?</p>
  
  <p>I want only critical entries to go in /tmp/log/critical.log and debug entries to go into /tmp/log/debug.log file while all enteries can go into /tmp/log/all.log log file.</p>
  
  <p>Following are entries in /etc/rsyslog.conf file</p>
  
  <pre><code>local0.*                                                /tmp/log/all.log
  local0.alert                                            /tmp/log/alert.log
  local0.crit                                             /tmp/log/critical.log
  local0.debug                                            /tmp/log/debug.log
  local0.emerg                                            /tmp/log/emergency.log
  local0.err                                              /tmp/log/error.log
  local0.info                                             /tmp/log/info.log
  local0.notice                                           /tmp/log/notice.log
  local0.warning                                          /tmp/log/warning.log
  </code></pre>
  
  <p>My sample c program writing syslog entries...</p>
  
  <pre><code>#include&lt;syslog.h&gt;
  
  main()
  {
      openlog("myapp",LOG_CONS|LOG_PID|LOG_NDELAY,LOG_LOCAL0);
  
      syslog(LOG_EMERG|LOG_LOCAL0,"Emergency",getuid());
      syslog(LOG_ALERT|LOG_LOCAL0,"Alert",getuid());
      syslog(LOG_CRIT|LOG_LOCAL0,"Critical",getuid());
      syslog(LOG_ERR|LOG_LOCAL0,"Error",getuid());
      syslog(LOG_WARNING|LOG_LOCAL0,"Warning",getuid());
      syslog(LOG_NOTICE|LOG_LOCAL0,"Notice",getuid());
      syslog(LOG_INFO|LOG_LOCAL0,"Information",getuid());
      syslog(LOG_DEBUG|LOG_LOCAL0,"Debug",getuid());
  
      closelog();
  }
  </code></pre>