From 26d9362e5d8075af8feebb0f108b2c18a2c6a08a Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur <dtantsur@redhat.com> Date: Wed, 11 Nov 2015 10:39:06 +0100 Subject: [PATCH] Make "Connect(ing|ed) to AMQP server" log messages DEBUG level According to our guidelines, INFO level is for unit-of-work messages valueable for an operator. This rules out "connecting" message. As to "connected", while it might fall under guidelines, it seems to flood logs without too much value, see for example: http://logs.openstack.org/98/219298/9/check/gate-tempest-dsvm-ironic-pxe_ipa/53784fb/logs/screen-ir-api.txt.gz?level=INFO Change-Id: I65e0f19590c42d25e5551d45af37416a01a7d638 --- oslo_messaging/_drivers/impl_rabbit.py | 8 ++++---- oslo_messaging/tests/drivers/test_impl_rabbit.py | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py index eaa866882..be41cc0f5 100644 --- a/oslo_messaging/_drivers/impl_rabbit.py +++ b/oslo_messaging/_drivers/impl_rabbit.py @@ -465,8 +465,8 @@ class Connection(object): }, ) - LOG.info(_LI('Connecting to AMQP server on %(hostname)s:%(port)s'), - self.connection.info()) + LOG.debug('Connecting to AMQP server on %(hostname)s:%(port)s', + self.connection.info()) # NOTE(sileht): kombu recommend to run heartbeat_check every # seconds, but we use a lock around the kombu connection @@ -491,8 +491,8 @@ class Connection(object): if purpose == rpc_amqp.PURPOSE_SEND: self._heartbeat_start() - LOG.info(_LI('Connected to AMQP server on %(hostname)s:%(port)s'), - self.connection.info()) + LOG.debug('Connected to AMQP server on %(hostname)s:%(port)s', + self.connection.info()) # NOTE(sileht): value chosen according the best practice from kombu # http://kombu.readthedocs.org/en/latest/reference/kombu.common.html#kombu.common.eventloop diff --git a/oslo_messaging/tests/drivers/test_impl_rabbit.py b/oslo_messaging/tests/drivers/test_impl_rabbit.py index 915715450..06c78982a 100644 --- a/oslo_messaging/tests/drivers/test_impl_rabbit.py +++ b/oslo_messaging/tests/drivers/test_impl_rabbit.py @@ -91,10 +91,12 @@ class TestHeartbeat(test_utils.BaseTestCase): if not heartbeat_side_effect: self.assertEqual(1, fake_ensure_connection.call_count) - self.assertEqual(2, fake_logger.info.call_count) + self.assertEqual(2, fake_logger.debug.call_count) + self.assertEqual(0, fake_logger.info.call_count) else: self.assertEqual(2, fake_ensure_connection.call_count) - self.assertEqual(3, fake_logger.info.call_count) + self.assertEqual(2, fake_logger.debug.call_count) + self.assertEqual(1, fake_logger.info.call_count) self.assertIn(mock.call(info, mock.ANY), fake_logger.info.mock_calls)