To test syslog, you have to setup syslog. Setting up syslog is system-specific and potentially quite variable because they frequently run syslogd replacements like rsyslogd (Ubuntu) or syslogd-ng. OSX has it's own internal system logger (the apple system logger) that supports the syslog API, but then adds additional stuff (like the 'syslog' command line application).
The idea is to add syslog configs to write to '/var/log/local2.log' for the local2 facility. In all cases, test with this:
logger -s -p local2.info -t example hello world
grep example /var/log/local2.log
Should print the 'hello world' log. These tests allow an alternate log file and/or facility via the SYSLOG_TEST_LOG_FILE and SYSLOG_TEST_FACILITY environment variables.
OS X has a fairly standard config, for a fairly standard syslogd (although it does not have the bells of something like the [syslogd on FreeBSD][http://www.freebsd.org/doc/handbook/configtuning-configfiles.html]).
echo 'local2.* /var/log/local2.log' > /etc/syslog.config
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist
How did you get gist to allow you to use
/in the filenames?When I try this, I get an error message:
I've been wanting to be able to do this for a long time. Any help is appreciated :)