Skip to content
Snippets Groups Projects
Commit 32bf9cad authored by Jan David Mol's avatar Jan David Mol
Browse files

TMSS-614: Warn if we cannot connect to RabbitMQ. This helps understand a later...

TMSS-614: Warn if we cannot connect to RabbitMQ. This helps understand a later error as the code retries with port -1.
parent 7a1311ae
Branches
No related tags found
1 merge request!352Resolve TMSS-614 "Usability patches"
......@@ -5,6 +5,8 @@ logger = logging.getLogger(__name__)
import kombu
# make default kombu/amqp logger less spammy
logging.getLogger("amqp").setLevel(logging.INFO)
# we're logging when this file is loaded, so format must be correct
logging.basicConfig(format = '%(asctime)s %(levelname)s %(message)s', level = logging.INFO)
from lofar.messaging import adaptNameToEnvironment
from lofar.common import isProductionEnvironment, isTestEnvironment
......@@ -59,6 +61,8 @@ for port in possible_ports:
except Exception as e:
logger.debug("cannot connect to broker: hostname=%s port=%s userid=%s password=*** error=%s",
DEFAULT_BROKER, port, DEFAULT_USER, e)
else:
logger.error("Cannot connect to rabbitmq broker with hostname=%s userid=%s password=***. I tried ports %s.", DEFAULT_BROKER, DEFAULT_USER, possible_ports)
# default exchange to use for publishing messages
DEFAULT_BUSNAME = adaptNameToEnvironment(os.environ.get('LOFAR_DEFAULT_EXCHANGE', 'lofar'))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment