Whenever gem logger in Docker

74 Views Asked by At

I wonder how to get whenever gem task logs from Docker container.

  task my_task: :environment do
    Rails.logger.info 'start task'
    MyModel.call_some_method
  end

Task is running well, I can see it by the changes done to database table. But for some reason I can't get any log information from container.

The only log I can fetch from container is:

# docker logs containerId
[write] crontab file updated

I tried to comment :output value in schedule.rb or use set :output, '/dev/stdout'.

But still no success.

Dockerfile:

...

ENTRYPOINT ["/rails/bin/docker-cron-entrypoint"]

CMD ["cron", "-f"]

docker-cron-entrypoint file:

#!/bin/bash -e
bundle exec whenever --update-crontab
exec "${@}"

UPDATE: Solved. In schedule.rb

set :output, '/proc/1/fd/1'
0

There are 0 best solutions below