From 3d226693343e3aa576b053aa83c73bd2e98629b1 Mon Sep 17 00:00:00 2001 From: Masahito Muroi Date: Tue, 29 Jan 2019 12:11:13 +0900 Subject: [PATCH] Use LOG.exception in except block in status module LOG.error doesn't display a stacktrace even when called in an except block. It makes hard for operators to analyze the cause of the error. LOG.exception displays a stacktrace as well as log messages. It helps the operator to find out more about the error from log messages. Change-Id: I365152b631870c1b949a29ac73b3ad2bd077bffa --- blazar/status.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blazar/status.py b/blazar/status.py index bdf6c918..24783240 100644 --- a/blazar/status.py +++ b/blazar/status.py @@ -203,8 +203,8 @@ class LeaseStatus(BaseStatus): try: result = func(*args, **kwargs) except Exception as e: - LOG.error('Lease %s went into ERROR status. %s', - lease_id, str(e)) + LOG.exception('Lease %s went into ERROR status. %s', + lease_id, str(e)) db_api.lease_update(lease_id, {'status': cls.ERROR}) raise e