kombu
kombu copied to clipboard
Use logger for "Restoring X unacknowledged message(s)"
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?
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.
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.