Celery: frustrating Django Logging

Created on 12 Oct 2017  路  1Comment  路  Source: celery/celery

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.

Django Logging

Most helpful comment

If you use Celery v4.1.0 try CELERY_WORKER_HIJACK_ROOT_LOGGER instead of CELERY_CELERYD_HIJACK_ROOT_LOGGER in your django config.

>All comments

If you use Celery v4.1.0 try CELERY_WORKER_HIJACK_ROOT_LOGGER instead of CELERY_CELERYD_HIJACK_ROOT_LOGGER in your django config.

Was this page helpful?
0 / 5 - 0 ratings