I recently set up the Scheduler add on and set up my rake task, 'rake cron_jobs:my_task'.
When I test it with 'heroku run rake cron_jobs:my_task', it works fine.
The scheduler also claims it ran when it was supposed to, and is scheduled to run again, but there's no logging associated with the process the way https://devcenter.heroku.com/articles/scheduler#inspecting-output says there should be.
'heroku ps' shows no scheduled dynos, 'heroku logs --ps scheduler.1' has no output.
What am I missing?
You can access the history of your logs by using one of the logging addons. Most of them offer a free tier too. They all are based on the log drains which you also could use directly, if you want to build it yourself. Show activity on this post.
Reliable delivery Heroku Scheduler is a free add-on, but it doesn't guarantee that jobs will be executed at their scheduled time, or at all for that matter. While it is rare, the possibility that a job may be skipped or run twice does exist.
Scheduling jobsOn the Scheduler Dashboard, click “Add Job…”, enter a task, select a frequency, dyno size, and next run time. Note that the next run time for daily jobs is in UTC.
EDIT: Yes, daily crons are free. See http://addons.heroku.com/. Now there's the scheduler add-on: addons.heroku.com/scheduler which is free. - The scheduler add-on will run any number of commands against your app, either every 10 minutes, every hour, or every day.
Actually I was trying to solve this myself, and did not find the answer anywhere, so here it is if someone else is struggling with this:
heroku logs --tail --ps scheduler
--tail
is important to keep streaming the logs.
My best guess: the heroku ps
and heroku logs
commands only give you status logs for currently running processes/dynos.
So after the scheduled rake
task is done, you can't reach the logs through the command line.
You can access the history of your logs by using one of the logging addons. Most of them offer a free tier too.
They all are based on the log drains which you also could use directly, if you want to build it yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With