Skip to content

Commit 5c62190

Browse files
committed
feat: Make the task handler log level configurable
Closes #650. The task handler is what feeds the log view in the Airflow web UI. Its level was pinned to INFO with no way to change it, so asking for DEBUG logs meant getting them in the files and the Vector aggregator but not in the UI, and there was no way to quiet the UI either. Render the level from the new task appender in the CRD. It defaults to INFO, which is what Airflow itself defaults to, so nothing changes for existing deployments. A task level below INFO also has to open up the logger it is wired to, otherwise the logger drops the records before the handler can filter them. A level above INFO must not raise the logger, since other handlers still want those records, so the logger level is the lower of the two. Both the stdlib template used by 2.x and 3.0.x and the structlog template used by 3.1 and later are covered.
1 parent a22eb38 commit 5c62190

6 files changed

Lines changed: 2409 additions & 46 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## [Unreleased]
44

5+
### Added
6+
7+
- The log level of the `task` handler, which is what the Airflow UI displays, is now
8+
configurable through the `task` appender in the CRD, alongside `console` and `file`.
9+
It defaults to `INFO`, matching Airflow's own default, so existing deployments are
10+
unaffected. This makes it possible to send DEBUG to the log files and the Vector
11+
aggregator while showing only INFO in the UI ([#829]).
12+
513
### Changed
614

715
- Internal operator refactoring: introduce a build() step in the reconciler that
@@ -13,6 +21,7 @@
1321
[#814]: https://github.com/stackabletech/airflow-operator/pull/814
1422
[#821]: https://github.com/stackabletech/airflow-operator/pull/821
1523
[#827]: https://github.com/stackabletech/airflow-operator/pull/827
24+
[#829]: https://github.com/stackabletech/airflow-operator/pull/829
1625

1726
## [26.7.0] - 2026-07-21
1827

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ tracing = "0.1"
3434

3535
[patch."https://github.com/stackabletech/operator-rs.git"]
3636
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }
37-
# stackable-operator = { path = "../operator-rs/crates/stackable-operator" }
37+
# TODO: Point back at a released tag once the task appender is released.
38+
# Depends on https://github.com/stackabletech/operator-rs/pull/1255
39+
stackable-operator = { git = "https://github.com/Churi12/operator-rs.git", branch = "feat/task-appender-log-config" }

docs/modules/airflow/pages/usage-guide/logging.adoc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
The logs can be forwarded to a Vector log aggregator by providing a discovery ConfigMap for the aggregator and by enabling the log agent:
55

66
NOTE: The `task` handler is responsible for showing the task logs in the UI.
7-
Unfortunately, the log level of the `task` handler cannot be specified.
8-
To avoid that all logs are emitted to the UI, the log level of the `airflow.task` logger is set explicitly to `INFO`.
9-
You can change the log level as shown below.
7+
Its log level is configured with the `task` appender, alongside `console` and `file`, and defaults to `INFO` as it does in Airflow itself.
8+
Because it is a separate appender, the UI can be given a different log level than the log files and the Vector aggregator, as shown below.
109

1110
[source,yaml]
1211
----
@@ -29,11 +28,14 @@ spec:
2928
enableVectorAgent: true
3029
containers:
3130
airflow:
31+
# Write DEBUG to the log files and the Vector aggregator, but only show INFO in the UI.
32+
file:
33+
level: DEBUG
34+
task:
35+
level: INFO
3236
loggers:
3337
"airflow.processor":
3438
level: INFO
35-
"airflow.task":
36-
level: DEBUG
3739
schedulers:
3840
config:
3941
logging:

0 commit comments

Comments
 (0)