title: c/c++ syslog to custom file (not /var/log/syslog but /var/log/mylog) - ubuntu 12.04
body: <p>I successfully tested the following syslog "hello world" example on ubuntu 12.04:</p>
  
  <pre><code>// gcc giuspexample.c -o giuspexample
  
  #include &lt;syslog.h&gt;
  
  int  main()
  {
      setlogmask(LOG_UPTO (LOG_NOTICE));
  
      openlog("atm", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL0);
  
      syslog(LOG_NOTICE, "Program started by User %d", getuid ());
      syslog(LOG_INFO, "A tree falls in a forest");
  
      closelog();
      return 0;
  }
  </code></pre>
  
  <p>and I can read the entry in /var/log/syslog.
  I followed the instructions on <a href="http://www.codealias.info/technotes/syslog_simple_example">http://www.codealias.info/technotes/syslog_simple_example</a> on how to change the destination filepath</p>
  
  <pre><code>echo "local0.*  /var/log/mylog" &gt;&gt; /etc/syslog.conf
  </code></pre>
  
  <p>but trying to run</p>
  
  <pre><code>sudo /etc/init.d/syslog restart
  </code></pre>
  
  <p>doesn't work (command not found) and rebooting the pc anyway doesn't start to write on /var/log/mylog but still on /var/log/syslog.
  Does anybody know what's wrong?
  Thanks.</p>