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?