title: Resque: Exceptions & stack traces
body: <p>I have a JRuby/Rails application comprising a web server to process HTTP requests, a MySQL database, and a Resque worker to process enqueued jobs. When I'm in development mode and something in the web application throws an exception, I get a nice trace in the browser, showing the exception thrown, the line at which it was thrown, relevant data, and a stack traceback. </p>
  
  <p>However, when exception-throwing code executes in a Resque worker, I get nothing, even if I know that the code has thrown an exception. The only way that I can debug is to throw in print statements and figure out where the last print statement was called before the Resque worker threw the exception and crashed. </p>
  
  <p>Is there a way to get the Resque worker to spit out an exception log and stack traceback into the log file (before it crashes), so that I can see what happened? </p>
  
  <p>EDIT - (Thanks for the idea @Viren) - And I don't want to litter my application code with begin/rescue blocks. I'll put the  begin/rescue code in once somewhere to make sure that the exception traceback gets logged, but I don't know where to put it. </p>