From 65288538e3642fbb916d2c9d1f615addffe49c21 Mon Sep 17 00:00:00 2001 From: Dayson Pais Date: Mon, 26 May 2014 17:16:19 +0530 Subject: [PATCH] More verbose logging if a Job throws an exception Presently, the logger just logs the primary error message with no stack trace of additional debugging information. Type casting the exception to a string gives a much efficient output and enables better debugging. --- lib/Resque/Worker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index d94aef5..7105a7b 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -241,7 +241,7 @@ class Resque_Worker $job->perform(); } catch(Exception $e) { - $this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', array('job' => $job, 'stack' => $e->getMessage())); +g $this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', array('job' => $job, 'stack' => (string)$e); $job->fail($e); return; }