Logging: Syslog for standalone applications?
For a toy commandline application in linux, I decided to go the syslog way. With the LOG_PERROR option (which I understand is widely supported within the *nixes), I can also redirect log messages to stderr, which makes syslog almost perfect for my use.
My problem is that I have to sudo to tail -f /var/log/user.log
, and I cannot find a way to tel开发者_开发百科l syslog to output msgs from my application to a separate log without editing syslog.conf, which again would require me to sudo. It'll be unacceptable for me to require users of my application to have sudo privilegss just so that they can view its logs.
It seems to be okay as long as I'm getting a copy on stderr, but still there seems to be something amiss. So, un-doubt me, brethren:
Is it kosher for drive-by applications to use syslog for their logging needs?
How widely is LOG_PERROR supported?
No, I don't want to use a logging library.
syslog
isn't really designed for use by normal user applications. It's intended for the system administrator's use.
精彩评论