code: def on_failure(self, exc, task_id, args, kwargs, einfo):
          
          log.error('[{}] failed due to {}'.format(task_id, getattr(einfo, 'traceback', None)))
          super(LoggedTask, self).on_failure(exc, task_id, args, kwargs, einfo)
docs: Capture the exception that caused the task to fail, if any.