From 8adde2fcb80b719348239bcfe70c9fedb2c39b33 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 8 Jun 2016 13:59:53 +0100 Subject: [PATCH] os_vif: fix logging of exceptions during plug/unplug The parameters to interpolate in the log message were being passed directly, instead of in a dict, so they were never actually merged into the message. While fixing this, we can also avoid manually including the exception in the message and leave it upto python logging by simply setting exc_info=True. Change-Id: Ib6adb52fb331ed148a6c250fd008e9c117f4cf68 --- os_vif/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/os_vif/__init__.py b/os_vif/__init__.py index 5903e30..5d25b8f 100644 --- a/os_vif/__init__.py +++ b/os_vif/__init__.py @@ -76,8 +76,8 @@ def plug(vif, instance_info): plugin.plug(vif, instance_info) LOG.info(_LI("Successfully plugged vif %s"), vif) except Exception as err: - LOG.error(_LE("Failed to plug vif %(vif)s. Got error: %(err)s"), - vif=vif, err=err) + LOG.error(_LE("Failed to plug vif %(vif)s"), + {"vif": vif}, exc_info=True) raise os_vif.exception.PlugException(vif=vif, err=err) @@ -109,8 +109,8 @@ def unplug(vif, instance_info): plugin.unplug(vif, instance_info) LOG.info(_LI("Successfully unplugged vif %s"), vif) except Exception as err: - LOG.error(_LE("Failed to unplug vif %(vif)s. Got error: %(err)s"), - vif=vif, err=err) + LOG.error(_LE("Failed to unplug vif %(vif)s"), + {"vif": vif}, exc_info=True) raise os_vif.exception.UnplugException(vif=vif, err=err)