Celery logger configuration

前端 未结 3 1068
花落未央
花落未央 2021-02-13 00:03

I\'m using Django 1.10, python 3.5 and celery 4.1.0 I\'m trying to log celery tasks info into a file. So I tried as suggested in celery documentation -

from cele         


        
3条回答
  •  既然无缘
    2021-02-13 00:17

    By default, celery will reset handers on celery.task logger, you could disable this behavior with worker_hijack_root_logger option. Or, you could reconfigure this logger in after_setup_task_logger signal, even dont let celery config the loggers with setup_logging signal:

    from celery.signals import setup_logging
    
    @setup_logging.connect()
    def config_loggers(*args, **kwargs):
        from logging.config import dictConfig
        dictConfig(app.config['LOGGING_CONFIG'])
    

提交回复
热议问题