MacOS – Where is the cron log file in MacOSX Lion

cronlogsmacos

I want to troubleshoot a cron job that worked fine until a recent modification, but I can't find the cron log file, where is it?

Best Answer

By default, cron does not log output of executed jobs. It is possible to log the fact that cronjobs have been executed, but that is not the default on OS X either.

In order to investigate cronjob execution output, I suggest modifying your cronjob line to redirect STDOUT and STDERR to logfiles. In your crontab file or after running crontab -e, however you go about it, add something like the following to your job line:

0 0 * * * yourcommand >/tmp/stdout.log 2>/tmp/stderr.log

Doing this should send STDOUT (normally printed or echo'ed output to STDOUT) to a text file named stdout.log in the /tmp directory, and STDERR to stderr.log in the temp directory. Many utilities use STDERR to print special error messages out when they're application errors, and not errors generated by the program's actual execution. (You can read more about STDERR on Wikipedia.)