From 65288538e3642fbb916d2c9d1f615addffe49c21 Mon Sep 17 00:00:00 2001 From: Dayson Pais Date: Mon, 26 May 2014 17:16:19 +0530 Subject: [PATCH 1/4] 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; } From b242280ecdfbbbce4de1648610b96cc0c128707f Mon Sep 17 00:00:00 2001 From: Dayson Pais Date: Mon, 26 May 2014 21:53:28 +0530 Subject: [PATCH 2/4] Removed erroneously introduced character. --- 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 7105a7b..4f7ef0c 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -241,7 +241,7 @@ class Resque_Worker $job->perform(); } catch(Exception $e) { -g $this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', array('job' => $job, 'stack' => (string)$e); + $this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', array('job' => $job, 'stack' => (string)$e); $job->fail($e); return; } From 760e38c0efca7353a411a5e785e541fbb48ab76d Mon Sep 17 00:00:00 2001 From: Dayson Pais Date: Mon, 26 May 2014 22:01:49 +0530 Subject: [PATCH 3/4] Fixed syntax error --- 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 4f7ef0c..2d6f649 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' => (string)$e); + $this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', array('job' => $job, 'stack' => (string)$e)); $job->fail($e); return; } From 2c8b215cda2beb50197b9527c3b0980c9e4f6505 Mon Sep 17 00:00:00 2001 From: Dayson Pais Date: Sat, 8 Nov 2014 15:11:20 +0530 Subject: [PATCH 4/4] Implicitly type cast exception while logging. Removed the unnecessary (string) type-casting. --- 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 2d6f649..750c41c 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' => (string)$e)); + $this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', array('job' => $job, 'stack' => $e)); $job->fail($e); return; }