Logging in delayed_job?

后端 未结 1 1694
谎友^
谎友^ 2020-12-25 10:24

I can\'t get any log output from delayed_job, and I\'m not sure my jobs are starting.

Here\'s my Procfile:

web:     bundle exec rails se         


        
相关标签:
1条回答
  • 2020-12-25 11:11

    When I needed log output from Delayed Jobs, I found this question to be fairly helpful.

    In config/initializers/delayed_job.rb I add the line:

    Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'dj.log'))
    

    Then, in my job, I output to this log with:

    Delayed::Worker.logger.info("Log Entry")
    

    This results in the file log/dj.log being written to. This works in development, staging, and production environments.

    0 讨论(0)
提交回复
热议问题