Merge "Python 3 deprecated the logger.warn method in favor of warning"
This commit is contained in:
commit
e15c11c499
@ -168,7 +168,7 @@ class ObsoleteReplyQueuesCache(object):
|
||||
self._no_reply_log(reply_q, msg_id)
|
||||
|
||||
def _no_reply_log(self, reply_q, msg_id):
|
||||
LOG.warn(_LW("%(reply_queue)s doesn't exists, drop reply to "
|
||||
LOG.warning(_LW("%(reply_queue)s doesn't exists, drop reply to "
|
||||
"%(msg_id)s"), {'reply_queue': reply_q,
|
||||
'msg_id': msg_id})
|
||||
|
||||
@ -251,7 +251,7 @@ class ReplyWaiters(object):
|
||||
def add(self, msg_id):
|
||||
self._queues[msg_id] = moves.queue.Queue()
|
||||
if len(self._queues) > self._wrn_threshold:
|
||||
LOG.warn(_LW('Number of call queues is greater than warning '
|
||||
LOG.warning(_LW('Number of call queues is greater than warning '
|
||||
'threshold: %(old_threshold)s. There could be a '
|
||||
'leak. Increasing threshold to: %(threshold)s'),
|
||||
{'old_threshold': self._wrn_threshold,
|
||||
|
@ -132,7 +132,8 @@ class Connection(object):
|
||||
self._send(message, topic)
|
||||
message = None
|
||||
except Exception:
|
||||
LOG.warn(_LW("Failed to publish a message of topic %s"), topic)
|
||||
LOG.warning(_LW("Failed to publish a message of topic %s"),
|
||||
topic)
|
||||
current_retry += 1
|
||||
if retry is not None and current_retry >= retry:
|
||||
LOG.exception(_LE("Failed to retry to send data "
|
||||
@ -238,10 +239,10 @@ class OsloKafkaMessage(base.IncomingMessage):
|
||||
super(OsloKafkaMessage, self).__init__(listener, ctxt, message)
|
||||
|
||||
def requeue(self):
|
||||
LOG.warn(_LW("requeue is not supported"))
|
||||
LOG.warning(_LW("requeue is not supported"))
|
||||
|
||||
def reply(self, reply=None, failure=None, log_failure=True):
|
||||
LOG.warn(_LW("reply is not supported"))
|
||||
LOG.warning(_LW("reply is not supported"))
|
||||
|
||||
|
||||
class KafkaListener(base.Listener):
|
||||
|
@ -438,15 +438,16 @@ class Connection(object):
|
||||
|
||||
self._url = ''
|
||||
if self.fake_rabbit:
|
||||
LOG.warn(_LW("Deprecated: fake_rabbit option is deprecated, set "
|
||||
"rpc_backend to kombu+memory or use the fake "
|
||||
LOG.warning(_LW("Deprecated: fake_rabbit option is deprecated, "
|
||||
"set rpc_backend to kombu+memory or use the fake "
|
||||
"driver instead."))
|
||||
self._url = 'memory://%s/' % virtual_host
|
||||
elif url.hosts:
|
||||
if url.transport.startswith('kombu+'):
|
||||
LOG.warn(_LW('Selecting the kombu transport through the '
|
||||
LOG.warning(_LW('Selecting the kombu transport through the '
|
||||
'transport url (%s) is a experimental feature '
|
||||
'and this is not yet supported.'), url.transport)
|
||||
'and this is not yet supported.'),
|
||||
url.transport)
|
||||
if len(url.hosts) > 1:
|
||||
random.shuffle(url.hosts)
|
||||
for host in url.hosts:
|
||||
@ -637,7 +638,7 @@ class Connection(object):
|
||||
|
||||
current_pid = os.getpid()
|
||||
if self._initial_pid != current_pid:
|
||||
LOG.warn(_LW("Process forked after connection established! "
|
||||
LOG.warning(_LW("Process forked after connection established! "
|
||||
"This can result in unpredictable behavior. "
|
||||
"See: http://docs.openstack.org/developer/"
|
||||
"oslo.messaging/transport.html"))
|
||||
@ -794,8 +795,8 @@ class Connection(object):
|
||||
if self.connection.supports_heartbeats:
|
||||
return True
|
||||
elif not self._heartbeat_support_log_emitted:
|
||||
LOG.warn(_LW("Heartbeat support requested but it is not supported "
|
||||
"by the kombu driver or the broker"))
|
||||
LOG.warning(_LW("Heartbeat support requested but it is not "
|
||||
"supported by the kombu driver or the broker"))
|
||||
self._heartbeat_support_log_emitted = True
|
||||
return False
|
||||
|
||||
|
@ -142,7 +142,7 @@ class Replies(pyngus.ReceiverEventHandler):
|
||||
del self._correlation[key]
|
||||
receiver.message_accepted(handle)
|
||||
else:
|
||||
LOG.warn(_LW("Can't find receiver for response msg id=%s, "
|
||||
LOG.warning(_LW("Can't find receiver for response msg id=%s, "
|
||||
"dropping!"), key)
|
||||
receiver.message_modified(handle, True, True, None)
|
||||
|
||||
|
@ -62,7 +62,7 @@ class SendTask(controller.Task):
|
||||
controller.request(self._target, self._request,
|
||||
self._results_queue, self._wait_for_reply)
|
||||
else:
|
||||
LOG.warn(_LW("Send request to %s aborted: TTL expired."),
|
||||
LOG.warning(_LW("Send request to %s aborted: TTL expired."),
|
||||
self._target)
|
||||
|
||||
|
||||
|
@ -301,7 +301,7 @@ class CheckForLoggingIssues(BaseASTChecker):
|
||||
# because:
|
||||
# 1. We have code like this that we'll fix when dealing with the %:
|
||||
# msg = _('....') % {}
|
||||
# LOG.warn(msg)
|
||||
# LOG.warning(msg)
|
||||
# 2. We also do LOG.exception(e) in several places. I'm not sure
|
||||
# exactly what we should be doing about that.
|
||||
if msg.id not in self.assignments:
|
||||
|
@ -112,7 +112,7 @@ class _OrderedTask(object):
|
||||
|
||||
while condition():
|
||||
if log_timer is not None and log_timer.expired():
|
||||
LOG.warn(_LW('Possible hang: %s'), msg)
|
||||
LOG.warning(_LW('Possible hang: %s'), msg)
|
||||
LOG.debug(''.join(traceback.format_stack()))
|
||||
# Only log once. After than we wait indefinitely without
|
||||
# logging.
|
||||
@ -346,10 +346,10 @@ class MessageHandlingServer(service.ServiceBase, _OrderedTaskRunner):
|
||||
"""
|
||||
# Warn that restarting will be deprecated
|
||||
if self._started:
|
||||
LOG.warn(_LW('Restarting a MessageHandlingServer is inherently '
|
||||
'racy. It is deprecated, and will become a noop in '
|
||||
'a future release of oslo.messaging. If you need to '
|
||||
'restart MessageHandlingServer you should '
|
||||
LOG.warning(_LW('Restarting a MessageHandlingServer is inherently '
|
||||
'racy. It is deprecated, and will become a noop '
|
||||
'in a future release of oslo.messaging. If you '
|
||||
'need to restart MessageHandlingServer you should '
|
||||
'instantiate a new object.'))
|
||||
self._started = True
|
||||
|
||||
|
@ -750,14 +750,14 @@ class TestServerLocking(test_utils.BaseTestCase):
|
||||
# DEFAULT_LOG_AFTER
|
||||
|
||||
log_event = threading.Event()
|
||||
mock_log.warn.side_effect = lambda _, __: log_event.set()
|
||||
mock_log.warning.side_effect = lambda _, __: log_event.set()
|
||||
|
||||
# Call stop without calling start. We should log a wait after 1 second
|
||||
thread = eventlet.spawn(self.server.stop)
|
||||
log_event.wait()
|
||||
|
||||
# Redundant given that we already waited, but it's nice to assert
|
||||
self.assertTrue(mock_log.warn.called)
|
||||
self.assertTrue(mock_log.warning.called)
|
||||
thread.kill()
|
||||
|
||||
@mock.patch.object(server_module, 'LOG')
|
||||
@ -766,14 +766,14 @@ class TestServerLocking(test_utils.BaseTestCase):
|
||||
# the number of seconds passed to log_after
|
||||
|
||||
log_event = threading.Event()
|
||||
mock_log.warn.side_effect = lambda _, __: log_event.set()
|
||||
mock_log.warning.side_effect = lambda _, __: log_event.set()
|
||||
|
||||
# Call stop without calling start. We should log a wait after 1 second
|
||||
thread = eventlet.spawn(self.server.stop, log_after=1)
|
||||
log_event.wait()
|
||||
|
||||
# Redundant given that we already waited, but it's nice to assert
|
||||
self.assertTrue(mock_log.warn.called)
|
||||
self.assertTrue(mock_log.warning.called)
|
||||
thread.kill()
|
||||
|
||||
@mock.patch.object(server_module, 'LOG')
|
||||
@ -782,14 +782,14 @@ class TestServerLocking(test_utils.BaseTestCase):
|
||||
# specified an absolute timeout
|
||||
|
||||
log_event = threading.Event()
|
||||
mock_log.warn.side_effect = lambda _, __: log_event.set()
|
||||
mock_log.warning.side_effect = lambda _, __: log_event.set()
|
||||
|
||||
# Call stop without calling start. We should log a wait after 1 second
|
||||
thread = eventlet.spawn(self.server.stop, log_after=1, timeout=2)
|
||||
log_event.wait()
|
||||
|
||||
# Redundant given that we already waited, but it's nice to assert
|
||||
self.assertTrue(mock_log.warn.called)
|
||||
self.assertTrue(mock_log.warning.called)
|
||||
thread.kill()
|
||||
|
||||
def test_timeout_wait(self):
|
||||
@ -835,4 +835,4 @@ class TestServerLocking(test_utils.BaseTestCase):
|
||||
self.server.stop, log_after=0, timeout=2)
|
||||
|
||||
# We timed out. Ensure we didn't log anything.
|
||||
self.assertFalse(mock_log.warn.called)
|
||||
self.assertFalse(mock_log.warning.called)
|
||||
|
Loading…
Reference in New Issue
Block a user