Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 766
Quazi Marufur Rahman Avatar asked Sep 20 '12 06:09

Quazi Marufur Rahman


2 Answers

Rails.logger should work fine:

Rails.logger.debug('foo bar')
like image 78
Russell Silva Avatar answered Oct 24 '22 07:10

Russell Silva


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!

like image 22
pdu Avatar answered Oct 24 '22 07:10

pdu