How to obtain the logs from function of the app when a task is running using celery? #5559
Replies: 3 comments 2 replies
-
Yea, I think we may be missing some config here. These posts seem to suggest that we need to do some setup using Celery signals:
There is a similar setup done in one of the projects I use, to configure the formatter to structured loging format |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer. I already set in my code : https://stackoverflow.com/questions/48289809/celery-logger-configuration, the answer about dictConfig(settings.LOGGING) Thank you for the first link https://dnmtechs.com/django-celery-logging-best-practices-for-python-3-programming/ And it works :) |
Beta Was this translation helpful? Give feedback.
-
May be it could be nice to improve cookiecutter with these inputs ? |
Beta Was this translation helpful? Give feedback.
-
I have a function on a model that write logs at INFO level.
When I call this function using Django Admin (for example), then I can see the logs in the file.
It is on a production server. I am using supervisor, in Django I log into console, in the supervisor configuration I set a stdout file.
When I call this function in a celery task, the log of this function is not written in any log. I can see the log from celery
Task.... received
. Celery is setup in a supervisor with a stdout too.The project was setup using cookiecutter.
I tried many things that I found on Google but nothing work.
Beta Was this translation helpful? Give feedback.
All reactions