Skip to content
Snippets Groups Projects
Verified Commit 45472d4b authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Explicitly configure Celery logger

parent b620dc65
No related branches found
No related tags found
1 merge request!1067Resolve "Celery does not honour logging configuration"
Pipeline #81455 passed
import logging
import os
from traceback import format_exception
......@@ -39,5 +40,5 @@ def task_failure_notifier(
@setup_logging.connect
def on_setup_logging(*args, **kwargs):
"""Prevent Celery from overriding logging configuration."""
pass # noqa
"""Load Django's logging configuration when running inside Celery."""
logging.config.dictConfig(settings.LOGGING)
......@@ -901,6 +901,12 @@ if not _settings.get("logging.disallowed_host", False):
"handlers": ["null"],
"propagate": False,
}
# Configure logging explicitly for Celery
LOGGING["loggers"]["celery"] = {
"handlers": ["console"],
"level": _settings.get("logging.level", "WARNING"),
"propagate": False,
}
# Rules and permissions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment