Using LOG.warning replace LOG.warn

*Python 3 deprecated the logger.warn method, see:
*https://docs.python.org/3/library/logging.html#logging.warning
*so we prefer to use warning to avoid DeprecationWarning.

Closes-Bug: #1529913

Change-Id: Iae9e13e89bb9566c2482017f631408a95ffe002d
This commit is contained in:
LiuNanke 2015-12-29 22:45:10 +08:00
parent 2b98c53862
commit 1ee6814457
3 changed files with 16 additions and 15 deletions

View File

@ -96,8 +96,8 @@ def enabled():
if __debug_state:
import threading
if threading.current_thread.__module__ == 'eventlet.green.threading':
LOG.warn(_("Enabling debugging with eventlet monkey patched "
"could produce unexpected behavior."))
LOG.warning(_("Enabling debugging with eventlet monkey"
" patched produce unexpected behavior."))
return __debug_state
@ -117,8 +117,9 @@ def __setup_remote_pydev_debug_safe(pydev_debug_host=None,
pydev_debug_port=pydev_debug_port,
pydev_path=pydev_path)
except Exception as e:
LOG.warn(_("Can't connect to remote debug server. Continuing to "
"work in standard mode. Error: %s."), e)
LOG.warning(_("Can't connect to remote debug server."
" Continuing to work in standard mode."
" Error: %s."), e)
return False

View File

@ -36,14 +36,14 @@ def setup_profiler(binary, host):
rpc.TRANSPORT, "trove", binary, host)
notifier.set(_notifier)
web.enable(CONF.profiler.hmac_keys)
LOG.warn(_LW("The OpenStack Profiler is enabled. Using one of the "
"hmac_keys specified in the trove.conf file "
"(typically in /etc/trove), a trace can be made of all "
"requests. Only an admin user can retrieve the trace "
"information, however.\n"
"To disable the profiler, add the following to the "
"configuration file:\n"
"[profiler]\n"
"enabled=false"))
LOG.warning(_LW("The OpenStack Profiler is enabled. Using one"
" of the hmac_keys specified in the trove.conf file "
"(typically in /etc/trove), a trace can be made of "
"all requests. Only an admin user can retrieve "
"the trace information, however.\n"
"To disable the profiler, add the following to the "
"configuration file:\n"
"[profiler]\n"
"enabled=false"))
else:
web.disable()

View File

@ -456,7 +456,7 @@ def load_any_instance(context, id, load_server=True):
return load_instance(BuiltInstance, context, id,
needs_server=load_server)
except exception.UnprocessableEntity:
LOG.warn(_LW("Could not load instance %s."), id)
LOG.warning(_LW("Could not load instance %s."), id)
return load_instance(FreshInstance, context, id, needs_server=False)
@ -569,7 +569,7 @@ class BaseInstance(SimpleInstance):
if self.slaves:
msg = _("Detach replicas before deleting replica source.")
LOG.warn(msg)
LOG.warning(msg)
raise exception.ReplicaSourceDeleteForbidden(msg)
self.update_db(task_status=InstanceTasks.DELETING,