Logs on your development machine can quickly grow to a silly size, especially if you have long running projects.

An easy cure for this is to set up logrotate (newsyslog on OS X) to rotate the logs once they grow past a certain point (1MiB in the example below), after all most of the time you’ll only be interested in the last few lines of your logs…

Create a new file in /etc/newsyslog.d called dev-logs.conf with the following contents:

# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/Users/USER/Programming/**/log/*.log USER:staff 644 2 1024 * G

You’ll need sudo rights in order to do this (the config file should be owned by root:wheel).

Note:

  1. Replace /Users/USER/Programming with the full path to your projects folder, e.g. /Users/bob/Programming
  2. Replace the USER in USER:staff with your username, e.g. bob:staff

The globbing pattern explained:

All log files within a log directory in any of your projects within your programming folder