Skip to content

Task logging does not show in the task log #59634

@Haapalaj

Description

@Haapalaj

Apache Airflow version

3.1.5

If "Other Airflow 3 version" selected, which one?

No response

What happened?

According to this document:
https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/logging-monitoring/logging-tasks.html

Logging inside python code executed in a task, this should work and has been working e.g. with airflow version 2.11.0:

import logging
logger = logging.getLogger(__name__)
logger.info("This is a log message")

The airflow LOGGING_LEVEL is set to INFO.

But only if giving e.g.
logger.log(55, 'The log msg content')
Then it would show up in the task log.
Seems like the logging level is somehow set wrong.

What you think should happen instead?

If logging like this inside python code executed by the airflow task, the log entries should be seen in the task log output:

import logging
logger = logging.getLogger(__name__)
logger.info("This is a log message")

How to reproduce

Create a DAG and a task and add logging to it as described:

import logging
logger = logging.getLogger(__name__)
logger.info("This is a log message")

Operating System

Debian GNU/Linux 12 (bookworm)

Versions of Apache Airflow Providers

airflow 3.1.5 (Image apache/airflow:3.1.5-python3.12
apache-airflow-providers-standard==1.10.1
apache-airflow-providers-snowflake==6.8.0
apache-airflow-providers-amazon==9.18.1
apache-airflow-providers-google==19.2.0
apache-airflow-providers-microsoft-azure==12.10.0
apache-airflow-providers-odbc==4.11.0
apache-airflow-providers-postgres==6.5.1
apache-airflow-providers-databricks==7.8.1
apache-airflow-task-sdk==1.1.5
apache-airflow-providers-fab==3.1.0

python3.12

Deployment

Official Apache Airflow Helm Chart

Deployment details

Docker compose

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions