How to configure syslog so that an applications log goes to a specific file

前端 未结 1 700
暗喜
暗喜 2021-02-20 01:59

I have an application myapp which should send log files only to /var/log/myapp.log. myapp is written in C++. The following sample

1条回答
  •  梦毁少年i
    2021-02-20 02:41

    According to the syslog(3) manpage, the first parameter for openlog() sets a prefix for log messages, not a filename. You can use a facility like LOG_LOCAL0 to flag your output and then configure syslogd using /etc/syslog.conf to send those logs to the file of your desire.

    0 讨论(0)
提交回复
热议问题