Use new log style when LOG.error

Use new log style replace the old Logger.exception()
in according to the link:
http://docs.openstack.org/developer/oslo.log/usage.html
Closes-Bug: #1529534

Change-Id: I5aa58bd6fa666c84dc200ecb44ba595f970f0613
This commit is contained in:
LiuNanke 2015-12-29 08:51:33 +08:00
parent 0c2b84321e
commit 362976dde6
3 changed files with 5 additions and 3 deletions

View File

@ -1091,7 +1091,7 @@ def servers_update_addresses(request, servers, all_tenants=False):
ports_floating_ips,
network_names)
except Exception as e:
LOG.error(e)
LOG.error(six.text_type(e))
else:
server.addresses = addresses

View File

@ -21,6 +21,7 @@ import logging
import operator
from oslo_utils import units
import six
from django.template.defaultfilters import filesizeformat # noqa
from django.utils.text import normalize_newlines # noqa
@ -688,7 +689,8 @@ class CustomizeAction(workflows.Action):
except Exception as e:
msg = _('There was a problem parsing the'
' %(prefix)s: %(error)s')
msg = msg % {'prefix': prefix, 'error': e}
msg = msg % {'prefix': prefix,
'error': six.text_type(e)}
raise forms.ValidationError(msg)
return script
else:

View File

@ -191,7 +191,7 @@ class TemplateForm(forms.SelfHandlingForm):
except Exception as e:
msg = _('There was a problem parsing the'
' %(prefix)s: %(error)s')
msg = msg % {'prefix': prefix, 'error': e}
msg = msg % {'prefix': prefix, 'error': six.text_type(e)}
raise forms.ValidationError(msg)
cleaned[data_str] = tpl