0

The app is running on Engine Yard. I need to log some data from inside the scripts ran by Whenever. Here's what it looks like:

schedule.rb:

every 1.minute do 
  rake 'my_tasks:task1 my_tasks:task2', :output => 'log/my_tasks.log'
end

task1 runs the script that has the following lines in it (just for testing purposes):

... 

log('test')


...

def self.log(string)
  logfile = '/var/log/engineyard/apps/my_app/test_log.log'
  File.open(logfile, 'a') { |log| log.puts(string << "\n\n") }
end

The problem is that none of the logs (my_tasks.log, test_log.log) get created, no matter what I tried. When I run bundle exec rake my_tasks:task1 from console it successfully creates the test_log.log file and logs the message. What could be wrong? Is it related to how Engine Yard works?

Vincent
  • 16,086
  • 18
  • 67
  • 73

1 Answers1

0

This is probably related to how Engine Yard works. I am not familiar with Engine Yard itself, but it is of a similar service as Heroku, and I know that in oder to send something to logs in Heroku, you have to use the stdout or stderr.

See here for more details about Heroku, and see if the same works for Engine Yard (keep in mind that this does not allow you to have separate log files, it simply puts the logged line in the same log file as other logged lines).

JeanMertz
  • 2,250
  • 2
  • 21
  • 26