diff --git a/rq/worker.py b/rq/worker.py index 267f9c1..44d5204 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -1498,7 +1498,9 @@ class Worker(BaseWorker): extra.update({'queue': job.origin, 'job_id': job.id}) # func_name - self.log.error('[Job %s]: exception raised while executing (%s)\n' + exc_string, job.id, func_name, extra=extra) + self.log.error( + '[Job %s]: exception raised while executing (%s)\n%s', job.id, func_name, exc_string, extra=extra + ) for handler in self._exc_handlers: self.log.debug('Invoking exception handler %s', handler) diff --git a/tests/test_worker.py b/tests/test_worker.py index 6b6d3d5..8f0c064 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -268,7 +268,7 @@ class TestWorker(RQTestCase): w.perform_job(job, queue) # An exception should be logged here at ERROR level - self.assertIn("Traceback", mock_logger_error.call_args[0][0]) + self.assertIn("Traceback", mock_logger_error.call_args[0][3]) def test_heartbeat(self): """Heartbeat saves last_heartbeat"""