It seams that Celery "hijacks" the logging in modules it is running as tasks. The documentation, specifically on the logging topic, is very sub-optimal, to say the least.
All log entries that are written in the modules run as celery tasks are duplicated on the celery console. Especially annoying are 3rd-party library logs that have been silent until run under celery.
E.g. We are using the elasticsearch package, which defines its own 'elasticsearch' logger and writes to it, but the entries are not actually written anywhere as it is not defined in the system (does not have any handlers). The package also does not set an effective level of its logger, so it should have the default of WARNING, i.e. INFO-level messages should be filtered out anyway.
When used in a celery task, the INFO messages from this package are suddenly printed on the celery console, and the effective level of the 'elasticsearch' logger is INFO.
My questions are:
- Does celery adds itself at the top logger hierarchy?
- Does celery change the effective level of all other loggers?
- What is the recommended way to change this back?
Thanks.