I have an application myapp
which should send log files only to /var/log/myapp.log
. myapp
is written in C++. The following sample code, sends the logs to /var/log/syslog only. My os is Linux - Ubuntu 12.04 - to be specific. I also found that my machine has rsyslog than syslog installed.
#include <stdio.h>
#include <unistd.h>
#include <syslog.h>
int main(void) {
openlog("myapp", LOG_PID|LOG_CONS, LOG_USER);
syslog(LOG_INFO, "abc 10");
closelog();
return 0;
}