Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku Scheduler not creating log

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?

like image 688
NoobException Avatar asked Dec 17 '14 16:12

NoobException


People also ask

How do I check my Heroku scheduler logs?

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.

Is Heroku scheduler reliable?

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.

How do I use Heroku scheduler?

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.

Does cron work on Heroku?

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.


2 Answers

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.

like image 85
Kevin Eaverquepedo Avatar answered Sep 28 '22 03:09

Kevin Eaverquepedo


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.

like image 24
Denis Cornehl Avatar answered Sep 28 '22 03:09

Denis Cornehl