mosquito / aio-pika

AMQP 0.9 client designed for asyncio and humans.
https://aio-pika.readthedocs.org/
Apache License 2.0
1.18k stars 186 forks source link

Discrepancies in logging behavior for same event across versions #545

Open abdul-malek-octane opened 1 year ago

abdul-malek-octane commented 1 year ago

I have two separate services, one that is using aio_pika==6.8.0 and another that uses aio_pika==9.0.4. They're both connected to the same RabbitMQ instance.

When the RabbitMQ node restarts, they both disconnect and seem to reconnect just fine (using connect_robust). However, version 6.8.0 gives this very clean output:

[INFO] Connection to amqps://<REDACTED>:5671//?no_verify_ssl=1 closed. Reconnecting after 5 seconds.

while version 9.0.4 gives this messy output (at exception level, not info):

[ERROR] Unexpected connection close from remote "amqps://<REDACTED>//?no_verify_ssl=1", Connection.Close(reply_code=320, reply_text='CONNECTION_FORCED - Node was put into maintenance mode')
[ERROR] NoneType: None

I understand that the source of the logs are different, even though they're reacting to the same event. Version 6.8.0's log comes from aio_pika's code here. But for some reason, in version 9.0.4 this block is bypassed and instead a deeper exception log from aiormq is triggered instead by the code here.

My question is why are different logging blocks being triggered between the two versions, and if this is the intended behavior. Thank you!