Configuring syslog for Drupal 7 on OS X 10.7 or 10.8 or 10.9

I'm running OS X 10.7 Lion. Today I'm working on some database-heavy code that also creates lots of watchdog entries. So I decided to turn off Drupal's database logging and turn on syslog.

I created a file for the log entries to go into:

sudo touch /var/log/drupal.log

I added one line to /etc/syslog.conf to tell OS X to put messages coming to the local3 logging facility into the new file.

local3.* /var/log/drupal.log

I rebooted. If I had a neckbeard I would have used launchctl instead.

Then I enabled syslog module on Drupal's module administration screen, went to Administration / Configuration / Development / Logging and errors and set the Syslog facility to LOG_LOCAL3.

And I turned off the database logging module.

Now I can happily watch incoming watchdog entries in a terminal with

tail -f /var/log/drupal.log

UPDATE: OS X 10.8 Mountain Lion and OS X 10.9 Mavericks are slightly different:

1. Just like above, create the log file with

sudo touch /var/log/drupal.log

2. Instead of adding a line to /etc/syslog.conf, add the following line to /etc/asl.conf:

# Drupal logging
? [= Facility local3] file /var/log/drupal.log

3. Restart logging with

sudo launchctl unload /System/Library/LaunchDaemons/
sudo launchctl load /System/Library/LaunchDaemons/