title: Django Celery Task Logging
body: <p>I have setup Celery in a Django project on which I am working. I would like to separate the logging for celery tasks vs the remainder of celery logs (celerycam, celerybeat, etc).</p>
  
  <p>Based on the Celery documentation (<a href="http://docs.celeryproject.org/en/latest/userguide/tasks.html#logging">http://docs.celeryproject.org/en/latest/userguide/tasks.html#logging</a>) it seems like I should just be able to define a Django logger for 'celery.task' which should do this. However, when I do this, nothing shows up in the logs. Everything does show up if I create a generic 'celery' logger, implying that this may be something to do with the name of the logger.</p>
  
  <p>What am I missing here? Is there a way to make this work, or must all celery logs go together?</p>
  
  <p>For what it's worth, I have set CELERYD_HIJACK_ROOT_LOGGER = False.</p>
  
  <p>My logging setup in settings.py:</p>
  
  <pre><code>LOGGING = {
      'version': 1,
      'disable_existing_loggers': False,
      'filters': {
          'require_debug_false': {
              '()': 'django.utils.log.RequireDebugFalse'
          }
      },
      'formatters': {
          'standard': {
              'format': '%(asctime)s %(levelname)s [%(name)s: %(lineno)s] -- %(message)s',
              'datefmt': '%m-%d-%Y %H:%M:%S'
          },
      },
      'handlers': {
          'logfile': {
              'level': 'INFO',
              'filters': None,
              'class': 'logging.handlers.RotatingFileHandler',
              'filename': '/vagrant/logs/logfile.log',
              'maxBytes': 1024*1024*5,
              'backupCount': 3,
              'formatter': 'standard'
          },
          'debug_logfile': {
              'level': 'DEBUG',
              'filters': None,
              'class': 'logging.handlers.RotatingFileHandler',
              'filename': '/vagrant/logs/debug_logfile.log',
              'maxBytes': 1024*1024*5,
              'backupCount': 5,
              'formatter': 'standard'
          },
          'default_logger': {
              'level': 'WARNING',
              'filters': None,
              'class': 'logging.handlers.RotatingFileHandler',
              'filename': '/vagrant/logs/default.log',
              'maxBytes': 1024*1024*5,
              'backupCount': 2,
              'formatter': 'standard'
          },
          'celery_logger': {
              'level': 'DEBUG',
              'filters': None,
              'class': 'logging.handlers.RotatingFileHandler',
              'filename': '/vagrant/logs/celery.log',
              'maxBytes': 1024*1024*5,
              'backupCount': 2,
              'formatter': 'standard'
          },
          'celery_task_logger': {
              'level': 'DEBUG',
              'filters': None,
              'class': 'logging.handlers.RotatingFileHandler',
              'filename': '/vagrant/logs/celery_tasks.log',
              'maxBytes': 1024*1024*5,
              'backupCount': 2,
              'formatter': 'standard'
          },
      },
      'loggers': {
          '': {
              'handlers': ['default_logger'],
              'level': 'WARNING',
              'propagate': True,
          },
          'django': {
              'handlers': ['logfile'],
              'level': 'INFO',
              'propagate': True,
          },
          'feedmanager': {
              'handlers': ['logfile', 'debug_logfile'],
              'level': 'DEBUG',
              'propagate': True,
          },
          'recipemanager': {
              'handlers': ['logfile', 'debug_logfile'],
              'level': 'DEBUG',
              'propagate': True,
          },
          'menumanager': {
              'handlers': ['logfile', 'debug_logfile'],
              'level': 'DEBUG',
              'propagate': True,
          },
          'celery.task': {
              'handlers': ['celery_task_logger'],
              'level': 'DEBUG',
              'propagate': True,
          },
          'celery': {
              'handlers': ['celery_logger'],
              'level': 'DEBUG',
              'propagate': True,
          },
      }
  }
  </code></pre>