Hi,
Celery Logging with a standard django logging setup is very frustrating.
i have a standard setup like
import logging
logger = logging.getLogger(__name__)
logger.error('test celery logging')
and the
setting CELERYD_HIJACK_ROOT_LOGGER to False does not work like expected.
all output from logging logs to syslog.
Also my root logger ('') uses file and sentry logging so i would expect it logs to file and sentry by default.
perhaps it complicates with the django LOGGING attribute 'disable_existing_loggers' or other defined loggers.
i had to include
@signals.setup_logging.connect
def setup_logging(**kwargs):
"""Setup logging."""
pass
in the config so my defined logging handlers work.
It would be nice to debug logging e.g. print the configured loggers at startup or provide more logging configuration in the docs or explain more in detail what has to be done to enable the correct logging path.
If you use Celery v4.1.0 try CELERY_WORKER_HIJACK_ROOT_LOGGER instead of CELERY_CELERYD_HIJACK_ROOT_LOGGER in your django config.
Most helpful comment
If you use Celery v4.1.0 try
CELERY_WORKER_HIJACK_ROOT_LOGGERinstead ofCELERY_CELERYD_HIJACK_ROOT_LOGGERin your django config.