I'm using the whenever gem for Rails 5. I'm trying to troubleshoot an issue, and after my default schedule.rb file was created at config/schedule.rb, I added some logging directives
# Learn more: http://github.com/javan/whenever
set :environment, "development"
every 10.minutes do
rake "events:calc_index", :output => {:error => 'error.log', :standard => 'cron.log'}
end
I restarted my Rails server (not sure if that matters or not) but I don't see these log files created anywhere. I have verified my crontab was set up by running "crontab -e" and seeing the job
0,10,20,30,40,50 * * * * /bin/bash -l -c 'cd /Users/davea/Documents/workspace/newproj && RAILS_ENV=development bundle exec rake events:calc_index '
Where are the log files created?
In your schedule.rb file you can specify the redirection options for your commands at a global or command level by setting the 'output' variable. This example is global level:
and you should put this global level set :output above your job definition, otherwise it wouldn't work Example:
Taken from: https://github.com/javan/whenever/wiki/Output-redirection-aka-logging-your-cron-jobs