I think we’ve all come upon this before, but when you want to debug a celery task in prod, it’s annoying because

 

    import logging

 

    @task
    def ….
        logging.error(“Something bad happened”)

 

does absolutely nothing! It turns out that celery has its own wrapper for the logging library that you have to use to make it work. All you have to do to make it work is replace `import logging` with

 

    from celery.log import get_task_logger
    logging = get_task_logger()

 

This logger will be named ‘celery.task.default’. I’ve added an entry to the settings.LOGGING for ‘celery.task’, so these will now get logged correctly.