I'm using the following command:
celery worker -l info -A django_app --concurrency=10 --autoreload
But DEBUG logs are still pouring out, same goes for when using -l warning
and --logfile
Any idea why Celery would ignore the log setting?
Further details:
the logs come from the Python
library suds
which outputs to the logger using DEBUG.
I had the same problem and I decide to to adjust loglevel inside settings.py
:
LOGGING['loggers']['celery'] = {
'handlers': ['console', <etc>],
'level': <LEVEL_YOU_WANT>,
'propagate': True,
}
Also I decide to disable some "not interesting" logs:
LOGGING['loggers']['celery.redirected'] = {
'handlers': ['console', <etc>],
'level': <LEVEL_YOU_WANT>,
'propagate': False,
}
for i in ['worker', 'concurrency', 'beat']:
LOGGING['loggers']['celery.' + i] = {
'handlers': [],
'level': 'WARNING',
'propagate': True,
}
for i in ['job', 'consumer', 'mediator', 'control', 'bootsteps']:
LOGGING['loggers']['celery.worker.' + i] = {
'handlers': [],
'level': 'WARNING',
'propagate': True,
}
Doing so will let you see only logs from you tasks, and not Celery's "machinery".
Try using the CELERYD_HIJACK_ROOT_LOGGER setting:
celery_instance = Celery('django_app')
celery_instance.add_defaults({
'CELERYD_HIJACK_ROOT_LOGGER': False,
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With