This is an automated email from the ASF dual-hosted git repository.
vatsrahul1001 pushed a commit to branch changes-3.2.1rc2
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit d8c85589cccf56532305f67a61292133a5fd3366
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Apr 17 21:57:49 2026 +0530
[v3-2-test] Fix DEFAULT_LOGGING_CONFIG use right kwargs (#65412) (#65424)
Fix DEFAULT_LOGGING_CONFIG use right kwargs (#65412)
(cherry picked from commit c74849b809780a608c59b6d124bf4f6f7985a37a)
Co-authored-by: AutomationDev85
<[email protected]>
---
.../config_templates/airflow_local_settings.py | 2 +-
.../test_airflow_local_settings.py | 76 ++++++++++++++++++++++
2 files changed, 77 insertions(+), 1 deletion(-)
diff --git
a/airflow-core/src/airflow/config_templates/airflow_local_settings.py
b/airflow-core/src/airflow/config_templates/airflow_local_settings.py
index 0c54c555735..04ca2a32f97 100644
--- a/airflow-core/src/airflow/config_templates/airflow_local_settings.py
+++ b/airflow-core/src/airflow/config_templates/airflow_local_settings.py
@@ -370,4 +370,4 @@ if REMOTE_LOGGING:
"section 'elasticsearch' if you are using Elasticsearch. In the
other case, "
"'remote_base_log_folder' option in the 'logging' section."
)
-
DEFAULT_LOGGING_CONFIG["handlers"]["task"].update(remote_task_handler_kwargs)
+ DEFAULT_LOGGING_CONFIG["handlers"]["task"].update(_handler_kwargs)
diff --git
a/airflow-core/tests/unit/config_templates/test_airflow_local_settings.py
b/airflow-core/tests/unit/config_templates/test_airflow_local_settings.py
new file mode 100644
index 00000000000..025dbdf571f
--- /dev/null
+++ b/airflow-core/tests/unit/config_templates/test_airflow_local_settings.py
@@ -0,0 +1,76 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+import importlib
+import json
+from unittest import mock
+
+import pytest
+
+from airflow.config_templates import airflow_local_settings
+
+from tests_common.test_utils.config import conf_vars
+
+
[email protected]
+def restore_local_settings():
+ yield
+ importlib.reload(airflow_local_settings)
+
+
[email protected](
+ ("remote_base", "remote_io_path"),
+ [
+ ("s3://bucket/path",
"airflow.providers.amazon.aws.log.s3_task_handler.S3RemoteLogIO"),
+ ("wasb-logs",
"airflow.providers.microsoft.azure.log.wasb_task_handler.WasbRemoteLogIO"),
+ ("gs://bucket/path",
"airflow.providers.google.cloud.log.gcs_task_handler.GCSRemoteLogIO"),
+ (
+ "cloudwatch://arn:aws:logs:us-east-1:0:log-group:foo",
+
"airflow.providers.amazon.aws.log.cloudwatch_task_handler.CloudWatchRemoteLogIO",
+ ),
+ ("oss://bucket/path",
"airflow.providers.alibaba.cloud.log.oss_task_handler.OSSRemoteLogIO"),
+ ("hdfs://host/path",
"airflow.providers.apache.hdfs.log.hdfs_task_handler.HdfsRemoteLogIO"),
+ ],
+ ids=["s3", "wasb", "gcs", "cloudwatch", "oss", "hdfs"],
+)
+def test_remote_task_handler_kwargs_not_leaked_to_local_task_handler(
+ remote_base, remote_io_path, restore_local_settings
+):
+ """Verify remote_task_handler_kwargs are passed to RemoteLogIO and not
leaked to FileTaskHandler."""
+ pytest.importorskip(remote_io_path.rsplit(".", 1)[0])
+ user_kwargs = {"remote_base": "ignored", "custom_key": "v"}
+ with (
+ mock.patch(remote_io_path) as mock_remote_io,
+ conf_vars(
+ {
+ ("logging", "remote_logging"): "True",
+ ("logging", "remote_base_log_folder"): remote_base,
+ ("logging", "remote_task_handler_kwargs"):
json.dumps(user_kwargs),
+ }
+ ),
+ ):
+ importlib.reload(airflow_local_settings)
+ task_cfg =
airflow_local_settings.DEFAULT_LOGGING_CONFIG["handlers"]["task"]
+ for k in user_kwargs:
+ assert k not in task_cfg, f"{k!r} leaked into task handler for
{remote_base}"
+
+ # Verify kwargs were passed to REMOTE_TASK_LOG
+ for k, v in user_kwargs.items():
+ assert mock_remote_io.call_args.kwargs[k] == v