I'm using daemon with the -o option to redirect all output to syslog. Despite also using the -n option to explicitly set a name all syslog entries have the ident daemon. This makes the syslog impractical when using more than one daemon.
Example:
daemon -n example -o user.info /usr/bin/ls /
libslack/msg.c sets the syslog ident correctly when initializing the msg object and calling openlog. However, the result of openlog does not survive the subsequent forks. Logging still works because syslog will call openlog implicitly when required, but then the ident is undefined and at least glibc will fall back to using the executable's name which is daemon of course.
As a simple workaround I've commented out the calls to prog_err_syslog and prog_dbg_syslog (line 5158f) which delays the call to openlog till after the fork when the regular output starts. The syslog ident is correct then.
A better way would be to re-initialize syslog output after a fork, but I've not yet found out how to do this safely and thus don't have a patch ready.
I'm using daemon with the
-ooption to redirect all output to syslog. Despite also using the-noption to explicitly set a name all syslog entries have the ident daemon. This makes the syslog impractical when using more than one daemon.Example:
libslack/msg.csets the syslog ident correctly when initializing the msg object and callingopenlog. However, the result ofopenlogdoes not survive the subsequent forks. Logging still works becausesyslogwill callopenlogimplicitly when required, but then the ident is undefined and at least glibc will fall back to using the executable's name which is daemon of course.As a simple workaround I've commented out the calls to
prog_err_syslogandprog_dbg_syslog(line 5158f) which delays the call toopenlogtill after the fork when the regular output starts. The syslog ident is correct then.A better way would be to re-initialize syslog output after a fork, but I've not yet found out how to do this safely and thus don't have a patch ready.