Last active
August 29, 2015 14:22
-
-
Save alexhayes/aea5389844ff9b853610 to your computer and use it in GitHub Desktop.
Setup celery logging with worker name in format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery.signals import celeryd_init, after_setup_task_logger | |
app = Celery('myapp') | |
# ... | |
# ... | |
# ... | |
@celeryd_init.connect | |
def configure_workers(sender=None, conf=None, **kwargs): | |
worker = sender | |
def tasks_setup_logging(**kwargs): | |
print "tasks_setup_logging", worker | |
after_setup_task_logger.connect(tasks_setup_logging) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment