celery / kombu

Messaging library for Python.
http://kombu.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
2.87k stars 928 forks source link

Use logger for "Restoring X unacknowledged message(s)" #872

Open blueyed opened 6 years ago

blueyed commented 6 years ago

I am seeing logged warnings via celery.redirected that are coming from kombu's print: https://github.com/celery/kombu/blob/09bd23bbd83344b09cbf38b7257107e560db9f25/kombu/transport/virtual/base.py#L285-L292.

Is there a reason why this prints to stderr directly, instead of using the logger?

georgepsarakis commented 6 years ago

Good observation. git blame does not show any particular reason, my guess is that it was mostly to ensure that these messages will be reported, in case the logger is not correctly setup. I believe they could be converted to logger.error.

risicle commented 8 months ago

This has bitten us too. It looks like there are a lot of places in kombu where print is used instead of a logger, and it makes it impossible to handle them as a structured log.

And if you've got your logging set up to only do structured logging, you'll likely miss it entirely.