4

I have a rake task running in the background using Delayed_Job. When I'm in development, the rake task writes to a rake.log file. But how do I get the log file written to in production?

I am on Cedar at Heroku with a rails 3.1 app. I have the heroku Logging addon installed, set to Expanded. I am using both 'puts' and 'Rails.logger' in the rake script. heroku logs and logs --tail works beautifully as a logger for the rest of the app, but the only logs for the rake task say that the worker process has started successfully.

The heroku docs say that "Anything written to standard out (stdout) or standard error (stderr) is captured into your logs. This means that you can log from anywhere in your application code with a simple puts statement". How can I make this true for code within a delayed job rake task?

snowangel
  • 3,452
  • 3
  • 29
  • 72
  • Your question has been asked and answered before. See answers [here](https://stackoverflow.com/questions/2195410/log-doesnt-work-in-production-with-delayed-job) and [here](https://stackoverflow.com/questions/3500200/getting-delayed-job-to-log). – Steve Wilhelm Oct 12 '11 at 05:24
  • God, so sorry. Search-fu obviously not set to 'high'. – snowangel Oct 12 '11 at 12:37
  • Actually Steve, I don't believe this has been answered before (at least in the links you've provided). The solutions for the links given seem to be either quite flaky, or involve writing to a log file (which you can't do on heroku). Here's a few things that bother me about your 'answer': 1. It doesn't actually provide an answer. 2. You've linked to the actual questions rather than the answers you wish to refer to. 3. I don't believe the answers linked to actually provide an answer to this exact question. 4. I feel like I've been led on a goose chase, with no answer to show for it. – Louis Sayers Sep 14 '13 at 20:39
  • This question has most certainly NOT been answered. How does one get Rake task output to show up in HEROKU Logs? @snowangel - since you marked this as answered, can you tell us what you did that worked to write to Heroku logs from a rake-task? – JosephK Apr 09 '16 at 03:34

0 Answers0