I successfully tested the following syslog hello world example on ubuntu 12.04:// gcc giuspexample.c -o giuspexample#include <syslog.h>int  main(int argc, char *argv[]){    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;}and I can read the entry in /var/log/syslog.I followed the instructions on http://www.codealias.info/technotes/syslog_simple_example on how to change the destination filepathecho local0.*  /var/log/mylog >> /etc/syslog.confbut trying to runsudo /etc/init.d/syslog restartdoesn'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.
(L)ubuntu 12.04 syslog to custom file (not /var/log/syslog but /var/log/mylog) - ubuntu 12.04
ubuntu;syslog
Ok, here's how I succeeded.In my folder /etc/rsyslog.d there are two files:20-ufw.conf and 50-default.confI added a file:sudo nano /etc/rsyslog.d/30-mycustomname.confWith the following content:# Log QSD Centro generated log messages to fileif $programname == 'centro' then /var/log/centro.log# Uncomment the following to stop logging anything that matches the last rule.& ~Then I check that the file /var/log/centro.log does not existsudo rm -f /var/log/centro.logThen I restart the servicesudo service rsyslog restartFinally The following code works:// gcc centro.c -o centro#include <stdio.h>#include <syslog.h>int  main(int argc, char *argv[]){    openlog(NULL, 0, LOG_USER);    syslog(LOG_INFO, MORTACCI TUA!!!);    closelog();    return 0;}Hope this helps.