Skip to content

Change the log level for "Variable not found" from error to debug when a default is provided. #52771

@vanchaxy

Description

@vanchaxy

Description

Change the log level for "Variable not found" from error to debug when a default is provided.

Use case/motivation

I'm testing migration to Airflow 3 and have noticed a lot of errors in the logs. The problem is that Airflow logs errors when a variable is not found, even if a default is provided.

In our use case, we have 100+ DAGs and use variables to configure schedules for them, so variables are read during DAG loading. This leads to significant error log spam that is picked up by Sentry. It's possible to work around this with custom logging filters, but I believe using the error log level is suboptimal and should be changed in Airflow core, especially considering Variable.get supports the "default" kwarg.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions