Celery logger configuration

前端 未结 3 989
花落未央
花落未央 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:18

    I was fiddling my logging this morning trying to figure out why my log was not progagated to the root logger, turned out as what @georgexsh said, celey is hijacking the root logger, here is my working logger config:

    'loggers': {
            'django.request': {
                'handlers': ['mail_admins'],
                'level': 'ERROR',
                'propagate': True,
            },
            'cal': {
                'handlers': ['general'],
                'level': 'INFO',
                'propagate': True,
            },
            '': {
                'handlers': ['gelf'],
                'level': 'INFO',
            }
        }
    

    And with CELERYD_HIJACK_ROOT_LOGGER = False in the settings.

    All the celery logs are now going to graylog(defined in root) instead of the usual place.

提交回复
热议问题