diff --git a/LCS/Messaging/python/messaging/config.py b/LCS/Messaging/python/messaging/config.py index 29c1a05413f26fe80fbc11e4baa40aadc1b2117d..e7f350333f565688590b9849f9146643e86fc12f 100644 --- a/LCS/Messaging/python/messaging/config.py +++ b/LCS/Messaging/python/messaging/config.py @@ -36,9 +36,7 @@ if isProductionEnvironment() or isTestEnvironment(): def broker_url(hostname: str=DEFAULT_BROKER, port: int=DEFAULT_PORT, userid: str=DEFAULT_USER, password :str=DEFAULT_PASSWORD) -> str: - url = 'amqp://%s:%s@%s:%d//' % (userid, password, hostname, port) - print(url) - return url + return 'amqp://%s:%s@%s:%d//' % (userid, password, hostname, port) if DEFAULT_PORT == -1: possible_ports = [5672, 5675] @@ -50,13 +48,13 @@ else: for port in possible_ports: try: - print("trying to connect to broker: hostname=%s port=%s userid=%s password=***" % ( - DEFAULT_BROKER, port, DEFAULT_USER)) + logger.debug("trying to connect to broker: hostname=%s port=%s userid=%s password=***", + DEFAULT_BROKER, port, DEFAULT_USER) with kombu.Connection(broker_url(port=port), max_retries=0, connect_timeout=1, ) as connection: connection.connect() DEFAULT_PORT = port - print("detected rabbitmq broker to which we can connect with hostname=%s port=%s userid=%s password=***" % ( - DEFAULT_BROKER, port, DEFAULT_USER)) + logger.info("detected rabbitmq broker to which we can connect with hostname=%s port=%s userid=%s password=***", + DEFAULT_BROKER, port, DEFAULT_USER) break except Exception as e: logger.debug("cannot connect to broker: hostname=%s port=%s userid=%s password=*** error=%s",