-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔊 add celery logging #87
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -377,6 +377,13 @@ | |
RuntimeWarning, | ||
) | ||
|
||
CELERY_LOGLEVEL = config( | ||
"CELERY_LOGLEVEL", | ||
default="INFO", | ||
help_text="control the verbosity of logging output for celery, separate from ``LOG_LEVEL``." | ||
" Available values are ``CRITICAL``, ``ERROR``, ``WARNING``, ``INFO`` and ``DEBUG``", | ||
) | ||
|
||
LOGGING_DIR = Path(BASE_DIR) / "log" | ||
|
||
logging_root_handlers = ["console"] if LOG_STDOUT else ["project"] | ||
|
@@ -415,6 +422,19 @@ | |
"class": "logging.StreamHandler", | ||
"formatter": "db", | ||
}, | ||
"console_celery": { | ||
"level": CELERY_LOGLEVEL, | ||
"class": "logging.StreamHandler", | ||
"formatter": "timestamped", | ||
}, | ||
"celery_file": { | ||
"level": CELERY_LOGLEVEL, | ||
"class": "logging.handlers.RotatingFileHandler", | ||
"filename": Path(LOGGING_DIR) / "celery.log", | ||
"formatter": "verbose", | ||
"maxBytes": 1024 * 1024 * 10, # 10 MB | ||
"backupCount": 10, | ||
}, | ||
"django": { | ||
"level": LOG_LEVEL, | ||
"class": "logging.handlers.RotatingFileHandler", | ||
|
@@ -507,6 +527,11 @@ | |
"level": "DEBUG", | ||
"propagate": True, | ||
}, | ||
"celery": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this will add the logs of the celery library itself, does the logging that happens inside celery tasks still work as well? Because from Sjoerd's issue I see that there is no logging at all. The regular logging is picked up by the project handler i think, even if it happens inside the celery worker There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check, I think it's fine to accept these changes then. I do think that the logs no longer showing has to do with either |
||
"handlers": ["console_celery"] if LOG_STDOUT else ["celery_file"], | ||
"level": CELERY_LOGLEVEL, | ||
"propagate": True, | ||
}, | ||
}, | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A note to rename one or the other