From f213c201ace818782646e390e3d48bb84dd14e8b Mon Sep 17 00:00:00 2001 From: Adam Sachs Date: Wed, 21 Feb 2024 10:53:55 -0500 Subject: [PATCH] configure logger on worker initialization (#4624) --- CHANGELOG.md | 8 +++++++- src/fides/api/tasks/__init__.py | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7e4cc073c..450fd27066 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,13 @@ The types of changes are: - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. -## [Unreleased](https://github.com/ethyca/fides/compare/2.30.0...main) +## [Unreleased](https://github.com/ethyca/fides/compare/2.30.1...main) + +## [2.30.1](https://github.com/ethyca/fides/compare/2.30.0...2.30.1) + +### Fixed +- Configure logger correctly on worker initialization [#4624](https://github.com/ethyca/fides/pull/4624) + ## [2.30.0](https://github.com/ethyca/fides/compare/2.29.0...2.30.0) diff --git a/src/fides/api/tasks/__init__.py b/src/fides/api/tasks/__init__.py index 47086b081e..4f89ea0e03 100644 --- a/src/fides/api/tasks/__init__.py +++ b/src/fides/api/tasks/__init__.py @@ -5,6 +5,8 @@ from sqlalchemy.orm import Session from fides.api.db.session import get_db_engine, get_db_session +from fides.api.util.logger import create_handler_dicts +from fides.api.util.logger import setup as setup_logging from fides.config import CONFIG, FidesConfig MESSAGING_QUEUE_NAME = "fidesops.messaging" @@ -44,6 +46,11 @@ def _create_celery(config: FidesConfig = CONFIG) -> Celery: """ Returns a configured version of the Celery application """ + setup_logging(config) + logger.bind(api_config=CONFIG.logging.json()).debug( + "Logger configuration options in use" + ) + app = Celery(__name__) celery_config: Dict[str, Any] = {