The Missing How-to for Celery Logging

Siddharth Pant
1 min readFeb 14, 2021

--

You have just decided to use Celery into your Django project and configured it already. All tasks are now created and are running correctly. So you deploy it on a server. Only issue is that logs will refuse to appear in your application server logs and you are losing any log capture for your celery workers.

Worry not! here is a production tested config for you so that your celery logs appear in your server logs in all their glory.

If not already follow my previous guide on how to do Django logging properly. Once your Django logging config is sorted out, now you can work on Celery config.

Generally for configuring Celery you will have created a file in your main Django app in which your settings.py file is present. Add a config_loggers function in that file so that it is now able to use your configured settings for logging instead of its own.

If you have already setup logging as in my previous guide it will there is no further steps required and now when you run your celery workers, you will notice they are spitting out logs with same configuration and formatting as your Django logs.

--

--

No responses yet