Remove translation of log messages from gluon
The i18n team has decided not to translate the logs because it's not
very helpful. See [1] and [2]. This removes the uses of _LE, _LI,
and _LW translation markers to simplify logging. Currently these
markers are causing the gate to fail for gluon.
[1] http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
[2] http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html
Change-Id: I2ed70abf5d9cd6a762b724113c10bc6ca70b5188
(cherry picked from commit 25a8b1634d
)
This commit is contained in:
parent
abbb4e6844
commit
3830d6d27a
|
@ -27,16 +27,6 @@ _C = _translators.contextual_form
|
|||
# The plural translation function using the name "_P"
|
||||
_P = _translators.plural_form
|
||||
|
||||
# Translators for log levels.
|
||||
#
|
||||
# The abbreviated names are meant to reflect the usual use of a short
|
||||
# name like '_'. The "L" is for "log" and the other letter comes from
|
||||
# the level.
|
||||
_LI = _translators.log_info
|
||||
_LW = _translators.log_warning
|
||||
_LE = _translators.log_error
|
||||
_LC = _translators.log_critical
|
||||
|
||||
|
||||
def get_available_languages():
|
||||
return oslo_i18n.get_available_languages(DOMAIN)
|
||||
|
|
|
@ -18,7 +18,7 @@ import sys
|
|||
from wsgiref import simple_server
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log._i18n import _LI
|
||||
from oslo_log._i18n import _
|
||||
from oslo_log import log as logging
|
||||
|
||||
from gluon.api import app as api_app
|
||||
|
@ -60,15 +60,15 @@ def main():
|
|||
host, port = cfg.CONF.api.host, cfg.CONF.api.port
|
||||
srv = simple_server.make_server(host, port, app)
|
||||
|
||||
LOG.info(_LI('Starting server in PID %s') % os.getpid())
|
||||
LOG.info('Starting server in PID %s' % os.getpid())
|
||||
LOG.debug("Configuration:")
|
||||
|
||||
if host == '0.0.0.0':
|
||||
LOG.info(_LI('serving on 0.0.0.0:%(port)s, '
|
||||
'view at http://127.0.0.1:%(port)s') %
|
||||
LOG.info(('serving on 0.0.0.0:%(port)s, '
|
||||
'view at http://127.0.0.1:%(port)s') %
|
||||
dict(port=port))
|
||||
else:
|
||||
LOG.info(_LI('serving on http://%(host)s:%(port)s') %
|
||||
LOG.info('serving on http://%(host)s:%(port)s' %
|
||||
dict(host=host, port=port))
|
||||
start_sync_thread(etcd_host=cfg.CONF.api.etcd_host,
|
||||
etcd_port=cfg.CONF.api.etcd_port)
|
||||
|
|
|
@ -25,7 +25,6 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
|
||||
from oslo_log._i18n import _
|
||||
from oslo_log._i18n import _LE
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
CONF = cfg.CONF
|
||||
|
@ -59,9 +58,9 @@ class GluonException(Exception):
|
|||
except Exception as e:
|
||||
# kwargs doesn't match a variable in the message
|
||||
# log the issue and the kwargs
|
||||
LOG.exception(_LE('Exception in string format operation'))
|
||||
LOG.exception('Exception in string format operation')
|
||||
for name, value in six.iteritems(kwargs):
|
||||
LOG.error(_LE("%(name)s: %(value)s") %
|
||||
LOG.error("%(name)s: %(value)s" %
|
||||
{'name': name, 'value': value})
|
||||
try:
|
||||
if CONF.fatal_exception_format_errors:
|
||||
|
|
|
@ -27,8 +27,6 @@ from oslo_utils import importutils
|
|||
from gluon import constants
|
||||
|
||||
from gluon._i18n import _
|
||||
from gluon._i18n import _LE
|
||||
from gluon._i18n import _LW
|
||||
|
||||
from gluon.api import attributes
|
||||
from gluon.common import exception as g_exc
|
||||
|
@ -119,8 +117,8 @@ def _build_subattr_match_rule(attr_name, attr, action, target):
|
|||
validate = attr['validate']
|
||||
key = [k for k in validate.keys() if k.startswith('type:dict')]
|
||||
if not key:
|
||||
LOG.warning(_LW("Unable to find data type descriptor "
|
||||
"for attribute %s"),
|
||||
LOG.warning(("Unable to find data type descriptor "
|
||||
"for attribute %s"),
|
||||
attr_name)
|
||||
return
|
||||
data = validate[key[0]]
|
||||
|
@ -278,8 +276,7 @@ class OwnerCheck(policy.Check):
|
|||
raise db_exc.RetryRequest(e)
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_LE('Policy check error while calling %s!'),
|
||||
f)
|
||||
LOG.exception('Policy check error while calling %s!', f)
|
||||
match = self.match % target
|
||||
if self.kind in creds:
|
||||
return match == six.text_type(creds[self.kind])
|
||||
|
|
|
@ -21,9 +21,7 @@ import threading
|
|||
import etcd
|
||||
|
||||
from gluon.db import api as dbapi
|
||||
from oslo_log._i18n import _LE
|
||||
from oslo_log._i18n import _LI
|
||||
from oslo_log._i18n import _LW
|
||||
from oslo_log._i18n import _
|
||||
from oslo_log import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -90,15 +88,15 @@ class SyncThread(threading.Thread):
|
|||
port_key = "/gluon/port/{0:s}".format(obj_key)
|
||||
self.etcd_client.delete(port_key)
|
||||
else:
|
||||
LOG.error(_LE("Unkown operation in msg %s") %
|
||||
LOG.error("Unkown operation in msg %s" %
|
||||
(msg["operation"]))
|
||||
except etcd.EtcdKeyNotFound:
|
||||
LOG.warn(_LW("Unknown key %s") % obj_key)
|
||||
LOG.warn("Unknown key %s" % obj_key)
|
||||
except Exception as e:
|
||||
print(e.__doc__)
|
||||
print(e.args[0])
|
||||
LOG.error(
|
||||
_LE("Error writing to etcd {doc}, {msg}").format(
|
||||
"Error writing to etcd {doc}, {msg}".format(
|
||||
doc=e.__doc__, msg=e.args[0]))
|
||||
raise ValueError
|
||||
|
||||
|
@ -106,14 +104,14 @@ class SyncThread(threading.Thread):
|
|||
while 1:
|
||||
try:
|
||||
msg = self.input_q.get(True, 10.0)
|
||||
LOG.info(_LI("SyncThread: received message %s ") % msg)
|
||||
LOG.info("SyncThread: received message %s " % msg)
|
||||
self.proc_sync_msg(msg)
|
||||
except queue.Empty:
|
||||
LOG.debug("SyncThread: Queue timeout")
|
||||
except ValueError:
|
||||
LOG.error(_LE("Error processing sync message"))
|
||||
LOG.error("Error processing sync message")
|
||||
break
|
||||
LOG.error(_LE("SyncThread exiting"))
|
||||
LOG.error("SyncThread exiting")
|
||||
SyncData.sync_thread_running = False
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue