“stomp.py” is a Python client library for accessing messaging servers (such as ActiveMQ or RabbitMQ) using the STOMP protocol (versions 1.0, 1.1 and 1.2). It can also be run as a standalone, command-line client for testing.
Apache License 2.0
495
stars
166
forks
source link
Request to hide exception message when connection to host fails. #322
I connect to a ActiveMQ which is running on multiple IPs (failover sites). I give three hosts to stomp.Connection(). When I attempt to connect, the first connection fails, and and the 2nd connection succeeds. In my log file, I get message like this:
stomp.py INFO - attempt reconnection (True, None, 0)
stomp.py INFO - Attempting connection to host XXX, port 8501
stomp.py WARNING - Could not connect to host XXX, port 8501
Traceback (most recent call last):
File "/nfs/anaconda3/lib/python3.7/site-packages/stomp/transport.py", line 737, in attempt_connection
self.socket = socket.create_connection(host_and_port, self.__timeout)
File "/nfs/anaconda3/lib/python3.7/socket.py", line 728, in create_connection
raise err
File "/nfs//anaconda3/lib/python3.7/socket.py", line 716, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
stomp.py INFO - Attempting connection to host XYZ, port 8501
stomp.py INFO - Established connection to host XYZ, port 8501
I would like to request the suppression of the exception message. The WARNING msg is OK. In transport.py, this line needs to be changed so that exc_info=0 instead of 1:
logging.warning("Could not connect to host %s, port %s", host_and_port[0], host_and_port[1], exc_info=1)
I connect to a ActiveMQ which is running on multiple IPs (failover sites). I give three hosts to stomp.Connection(). When I attempt to connect, the first connection fails, and and the 2nd connection succeeds. In my log file, I get message like this:
I would like to request the suppression of the exception message. The WARNING msg is OK. In transport.py, this line needs to be changed so that exc_info=0 instead of 1:
logging.warning("Could not connect to host %s, port %s", host_and_port[0], host_and_port[1], exc_info=1)