Skip to content

Propagate resolved task log level to language SDK runtimes#68712

Open
jason810496 wants to merge 2 commits into
apache:mainfrom
jason810496:task-sdk/propagate-log-level-in-startup-details
Open

Propagate resolved task log level to language SDK runtimes#68712
jason810496 wants to merge 2 commits into
apache:mainfrom
jason810496:task-sdk/propagate-log-level-in-startup-details

Conversation

@jason810496

@jason810496 jason810496 commented Jun 18, 2026

Copy link
Copy Markdown
Member

Why

Pointed out in above related link, we should propagate the logging_level info from Supervisor (Task-SDK world) to Lang-SDK runtime to respect the Airflow side conf. So that no matter user configure the [logging/logging_level] using airflow.cfg or secret backend, the Lang-SDK runtime should retrieve the same conf.

How

Here're the approach we came up with:

  1. (Current approach) Passing as AIRFLOW__LOGGING__LOGGING_LEVEL env, each Lang-SDK will consume by os.environ themself.
  2. Passing by CLI flag like java -classpath ... --comms=... --logs=... --logging-level=... CLI. Cons: We will introduce a new CLI flag for all the further conf propagation. (There isn't --comms or --logs equivalent Airflow env, so having the existing --comms, --logs as-is is a valid direction)
  3. Passing by StartUpDetails.logging_level. Cons: Caught by @uranusjr that the Task subprocess had already started producing logs (e.g. logging for connecting to the coordinator) before the Task subprocess got the StartUpDetails msgpack, which causes the wrong logging level at the Task subprocess startup time.

Was generative AI tooling used to co-author this PR?

@jason810496 jason810496 self-assigned this Jun 18, 2026
@jason810496 jason810496 added AIP-108: Coordinator Change this to an 'area:' label after AIP acceptance. affected_version:3.3.0beta Use this label to add issues found during 3.3.0 testing labels Jun 18, 2026
@jason810496 jason810496 added this to the Airflow 3.3.0 milestone Jun 18, 2026
Comment thread task-sdk/src/airflow/sdk/coordinators/_subprocess.py Outdated
@uranusjr

Copy link
Copy Markdown
Member

We should also mention this in sdk contribution doc. Each sdk needs to handle this on their own.

A language-SDK runtime (Java, Go) launched by a coordinator cannot read
Airflow's configuration, so it could only guess the task log level from
inherited environment variables. The subprocess starts before the
StartupDetails handshake arrives, so carrying the level in that message
would reach it too late. Passing the supervisor-resolved level in the
environment at launch makes it available before the runtime configures
logging.
The root log level alone does not reflect a user's per-logger overrides
(`[logging] namespace_levels`), so a runtime would still emit logs the
worker is configured to suppress. Passing the levels alongside the root
level keeps the runtime's filtering consistent with the rest of Airflow.
Each language SDK reads and applies these on its own, so the contract is
documented for SDK authors.
@jason810496 jason810496 force-pushed the task-sdk/propagate-log-level-in-startup-details branch from 5c2a5d3 to b5e450b Compare June 19, 2026 04:36

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Ash and TP for the review.
Addressed both comments in b5e450b.

@jason810496 jason810496 requested a review from ashb June 19, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

affected_version:3.3.0beta Use this label to add issues found during 3.3.0 testing AIP-108: Coordinator Change this to an 'area:' label after AIP acceptance. area:task-sdk

Development

Successfully merging this pull request may close these issues.

3 participants