jason810496 commented on code in PR #67104:
URL: https://github.com/apache/airflow/pull/67104#discussion_r3540799694
##########
airflow-core/src/airflow/logging_config.py:
##########
@@ -120,6 +120,44 @@ def load_logging_config() -> tuple[dict[str, Any], str]:
) or DEFAULT_LOGGING_CONFIG_PATH
+def _warn_if_missing_remote_task_log(logging_class_path: str) -> None:
+ """
+ Warn if ``[logging] remote_logging`` is on but the user module exposes no
remote IO.
+
+ Runs *after* ``dictConfig`` has constructed handlers, so deprecated
+ self-registration in provider task handlers (Elasticsearch, OpenSearch) has
+ already had its chance to populate
``_ActiveLoggingConfig.remote_task_log``.
+ Only fires for user-defined ``logging_config_class`` values; the stock
+ fallback is exempt.
+
+ :param logging_class_path: the resolved ``[logging] logging_config_class``
+ dotted path (already defaulted to :data:`DEFAULT_LOGGING_CONFIG_PATH`).
+ """
+ # An empty path is not a meaningful override -- ``_get_logging_config()``
treats it the
+ # same as unset and falls back to ``DEFAULT_LOGGING_CONFIG_PATH``, so it
must not be
+ # treated as a user-defined logging config class here either.
+ has_user_defined_logging_config_class = (
+ bool(logging_class_path) and logging_class_path !=
DEFAULT_LOGGING_CONFIG_PATH
+ )
+ remote_logging_enabled = conf.getboolean("logging", "remote_logging",
fallback=False)
+ if not (has_user_defined_logging_config_class and remote_logging_enabled):
+ return
+ if _ActiveLoggingConfig.remote_task_log is not None:
Review Comment:
I just set the `_ActiveLoggingConfig.remote_task_log` with `None` as default
in
https://github.com/apache/airflow/pull/67104/changes/66b52a6f8773b85790a741d386654ff378ac1758
##########
airflow-core/src/airflow/logging_config.py:
##########
@@ -120,6 +120,44 @@ def load_logging_config() -> tuple[dict[str, Any], str]:
) or DEFAULT_LOGGING_CONFIG_PATH
+def _warn_if_missing_remote_task_log(logging_class_path: str) -> None:
+ """
+ Warn if ``[logging] remote_logging`` is on but the user module exposes no
remote IO.
+
+ Runs *after* ``dictConfig`` has constructed handlers, so deprecated
+ self-registration in provider task handlers (Elasticsearch, OpenSearch) has
+ already had its chance to populate
``_ActiveLoggingConfig.remote_task_log``.
+ Only fires for user-defined ``logging_config_class`` values; the stock
+ fallback is exempt.
+
+ :param logging_class_path: the resolved ``[logging] logging_config_class``
+ dotted path (already defaulted to :data:`DEFAULT_LOGGING_CONFIG_PATH`).
+ """
+ # An empty path is not a meaningful override -- ``_get_logging_config()``
treats it the
+ # same as unset and falls back to ``DEFAULT_LOGGING_CONFIG_PATH``, so it
must not be
+ # treated as a user-defined logging config class here either.
+ has_user_defined_logging_config_class = (
+ bool(logging_class_path) and logging_class_path !=
DEFAULT_LOGGING_CONFIG_PATH
+ )
+ remote_logging_enabled = conf.getboolean("logging", "remote_logging",
fallback=False)
+ if not (has_user_defined_logging_config_class and remote_logging_enabled):
+ return
+ if _ActiveLoggingConfig.remote_task_log is not None:
Review Comment:
Nice catch, I just set the `_ActiveLoggingConfig.remote_task_log` with
`None` as default in
https://github.com/apache/airflow/pull/67104/changes/66b52a6f8773b85790a741d386654ff378ac1758
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]