Search code examples
ruby-on-railsrubyresque

How to debug resque job in rails application


How can I debug a resque job in rails application? I just want to write some info in a log file from self.perform function. I have written this

system("echo sos >> /home/maruf/Desktop/log.txt")

in self.perform(). But nothing happened. What is the proper way?


Solution

  • Why not use the Logger facility?

    log = Logger.new 'log/resque.log'
    log.debug "foo bar"
    

    And then tail -f your newly generated log in "#{Rails.root}/log/resque.log'. Remember to restart your resque workers as they cache the code and won't pick up changes like the rest of your development environment!