Skip to content

Commit 8690c3a

Browse files
Fix: airflow.task log level default to INFO (#649)
* set INFO as default for airflow.task logging * Add documentation * Add example to docs * Using handler task to set log level, update comment * Moving handler to comment * update Changelog.md * fixing typo * Better documentation Co-authored-by: Siegfried Weber <mail@siegfriedweber.net> * More robust decision makeing --------- Co-authored-by: Siegfried Weber <mail@siegfriedweber.net>
1 parent c805f72 commit 8690c3a

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Use `--console-log-format` (or `CONSOLE_LOG_FORMAT`) to set the format to `plain` (default) or `json`.
1212
- Add support for airflow `2.10.5` ([#625]).
1313
- Add experimental support for airflow `3.0.1` ([#630]).
14+
- "airflow.task" logger defaults to log level 'INFO' instead of 'NOTSET' ([#649]).
1415

1516
### Changed
1617

@@ -50,6 +51,7 @@
5051
[#630]: https://github.com/stackabletech/airflow-operator/pull/630
5152
[#636]: https://github.com/stackabletech/airflow-operator/pull/636
5253
[#645]: https://github.com/stackabletech/airflow-operator/pull/645
54+
[#649]: https://github.com/stackabletech/airflow-operator/pull/649
5355

5456
## [25.3.0] - 2025-03-21
5557

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

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

6+
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.
10+
611
[source,yaml]
712
----
813
spec:
@@ -26,6 +31,8 @@ spec:
2631
loggers:
2732
"airflow.processor":
2833
level: INFO
34+
"airflow.task":
35+
level: DEBUG
2936
schedulers:
3037
config:
3138
logging:

rust/operator-binary/src/product_logging.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ for logger_name, logger_config in LOGGING_CONFIG['loggers'].items():
114114
# otherwise DAGs cannot be loaded anymore.
115115
if logger_name != 'airflow.task':
116116
logger_config['propagate'] = True
117+
# The default behavior of airflow is to enforce log level 'INFO' on tasks. (https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#logging-level)
118+
# TODO: Make task handler log level configurable through CRDs with default 'INFO'.
119+
# e.g. LOGGING_CONFIG['handlers']['task']['level'] = {{task_log_level}}
120+
if 'handlers' in logger_config and 'task' in logger_config['handlers']:
121+
logger_config['level'] = logging.INFO
117122
118123
LOGGING_CONFIG.setdefault('formatters', {{}})
119124
LOGGING_CONFIG['formatters']['json'] = {{

0 commit comments

Comments
 (0)