From 31a149a4df91d8488d783e19da5531bb997e59bd Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Tue, 2 Dec 2014 15:48:34 +0100 Subject: [PATCH] Add a info log when a reconnection occurs This change adds a info log when a reconnection occurs like we have before. Change-Id: I3b7d86894efac09e27125c368fc83e83c36b630e --- oslo/messaging/_drivers/impl_rabbit.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/oslo/messaging/_drivers/impl_rabbit.py b/oslo/messaging/_drivers/impl_rabbit.py index 4d9d7c893..732d183f6 100644 --- a/oslo/messaging/_drivers/impl_rabbit.py +++ b/oslo/messaging/_drivers/impl_rabbit.py @@ -34,6 +34,7 @@ from oslo.messaging._drivers import amqp as rpc_amqp from oslo.messaging._drivers import amqpdriver from oslo.messaging._drivers import common as rpc_common from oslo.messaging._i18n import _ +from oslo.messaging._i18n import _LI from oslo.messaging import exceptions from oslo.utils import netutils @@ -504,13 +505,13 @@ class Connection(object): self._url, ssl=self._ssl_params, login_method=self._login_method, failover_strategy="shuffle") - LOG.info(_('Connecting to AMQP server on %(hostname)s:%(port)d'), + LOG.info(_LI('Connecting to AMQP server on %(hostname)s:%(port)d'), {'hostname': self.connection.hostname, 'port': self.connection.port}) # NOTE(sileht): just ensure the connection is setuped at startup self.ensure(error_callback=None, method=lambda channel: True) - LOG.info(_('Connected to AMQP server on %(hostname)s:%(port)d'), + LOG.info(_LI('Connected to AMQP server on %(hostname)s:%(port)d'), {'hostname': self.connection.hostname, 'port': self.connection.port}) @@ -632,6 +633,11 @@ class Connection(object): for consumer in self.consumers: consumer.reconnect(new_channel) + LOG.info(_LI('Reconnected to AMQP server on ' + '%(hostname)s:%(port)d'), + {'hostname': self.connection.hostname, + 'port': self.connection.port}) + recoverable_errors = (self.connection.recoverable_channel_errors + self.connection.recoverable_connection_errors) try: