Lee-W commented on code in PR #67104:
URL: https://github.com/apache/airflow/pull/67104#discussion_r3535481719
##########
airflow-core/src/airflow/logging_config.py:
##########
@@ -171,6 +209,14 @@ def configure_logging():
# otherwise Airflow would silently fall back on the default config
raise e
+ # Runs after dictConfig so deprecated handler self-registration (ES/OS) has
+ # had its chance to populate _ActiveLoggingConfig.remote_task_log.
+ logging_class_path = (
+ conf.get("logging", "logging_config_class",
fallback=DEFAULT_LOGGING_CONFIG_PATH)
Review Comment:
is it also trying to handle
```ini
[logging]
loggin_config_class = ""
```
##########
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:
Are we certain this will be set at this time? `_ActiveLoggingConfig` comes
with no default value. I just tested it with
```pycon
In [1]: from airflow.logging_config import _ActiveLoggingConfig
In [2]: _ActiveLoggingConfig.remote_task_log
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 _ActiveLoggingConfig.remote_task_log
AttributeError: type object '_ActiveLoggingConfig' has no attribute
'remote_task_log'
```
--
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]