Ensure log messages are not translated

This is VPNaaS dashboard version of the horizon patch
https://review.openstack.org/#/c/455635/.
The horizon patch was merged before VPNaaS dashboard split out,
but unfortunately I failed to import the change.

The following describes the rational of this change
(quoted from the horizon change).
----
Previously translated messages are included in log messages
and it was determined what language is chosen by users.
It makes difficult for operators to understand log messgaes.

This commit tries to use English messages for all log messages.
The following policies are applied based on the past discussions
in the bug 1406333 and related reviews.

- English messages are used for log messages.
- log messages include exception messages if possible
  to help operators identify what happens.
- Use ID rather than name for log messages
  as ID is much more unique compared to name.
- LOG.debug() in success code path are deleted.
  We don't log success messages in most places and API calls to
  back-end services can be logged from python bindings.

Change-Id: I1a37b7ccbfa29cd83456931f7864ad9ce31aa570
Closes-Bug: #1406333
This commit is contained in:
Akihiro Motoki 2017-08-09 08:43:49 +00:00
parent 3f13b3bbd4
commit 66c1e46086
1 changed files with 8 additions and 8 deletions

View File

@ -49,12 +49,12 @@ class UpdateVPNService(forms.SelfHandlingForm):
request, context['vpnservice_id'], **data)
msg = (_('VPN Service %s was successfully updated.')
% context['name'])
LOG.debug(msg)
messages.success(request, msg)
return vpnservice
except Exception as e:
LOG.info('Failed to update VPN Service %(id)s: %(exc)s',
{'id': context['vpnservice_id'], 'exc': e})
msg = _('Failed to update VPN Service %s') % context['name']
LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
redirect = reverse(self.failure_url)
exceptions.handle(request, msg, redirect=redirect)
@ -128,12 +128,12 @@ class UpdateIKEPolicy(forms.SelfHandlingForm):
request, context['ikepolicy_id'], **data)
msg = (_('IKE Policy %s was successfully updated.')
% context['name'])
LOG.debug(msg)
messages.success(request, msg)
return ikepolicy
except Exception as e:
LOG.info('Failed to update IKE Policy %(id)s: %(exc)s',
{'id': context['ikepolicy_id'], 'exc': e})
msg = _('Failed to update IKE Policy %s') % context['name']
LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
redirect = reverse(self.failure_url)
exceptions.handle(request, msg, redirect=redirect)
@ -206,12 +206,12 @@ class UpdateIPSecPolicy(forms.SelfHandlingForm):
request, context['ipsecpolicy_id'], **data)
msg = (_('IPSec Policy %s was successfully updated.')
% context['name'])
LOG.debug(msg)
messages.success(request, msg)
return ipsecpolicy
except Exception as e:
LOG.info('Failed to update IPSec Policy %(id)s: %(exc)s',
{'id': context['ipsecpolicy_id'], 'exc': e})
msg = _('Failed to update IPSec Policy %s') % context['name']
LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
redirect = reverse(self.failure_url)
exceptions.handle(request, msg, redirect=redirect)
@ -312,12 +312,12 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
request, context['ipsecsiteconnection_id'], **data)
msg = (_('IPSec Site Connection %s was successfully updated.')
% context['name'])
LOG.debug(msg)
messages.success(request, msg)
return ipsecsiteconnection
except Exception as e:
LOG.info('Failed to update IPSec Site Connection %(id)s: %(exc)s',
{'id': context['ipsecsiteconnection_id'], 'exc': e})
msg = (_('Failed to update IPSec Site Connection %s')
% context['name'])
LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
redirect = reverse(self.failure_url)
exceptions.handle(request, msg, redirect=redirect)