Skip to content

Logging dictionary object in task fails (structlog/stdlib misconfiguration) #62472

@kosteev

Description

@kosteev

Apache Airflow version

main (development)

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

No response

What happened?

Task that does:
d = {'a': 3}
logging.info('with format %s', d)

produces error log messages (but task succeeds)

What you think should happen instead?

No response

How to reproduce

  1. Run breeze
  2. Deploy DAG
from airflow.models.dag import DAG
from airflow.sdk import task
from datetime import datetime

import logging

@task
def print_dict():
    d = {'a': 3}
    print(d) # <- ok
    logging.info(d) # <- ok
    logging.info(f'with f string {d}') # <- ok
    logging.info('with format %s', d) # <- ERROR

with DAG(
    dag_id="print_dict_dag",
    start_date=datetime(2023, 1, 1),
    schedule=None,
    catchup=False,
) as dag:
    t0 = print_dict()
  1. Observe
Image

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Other

Deployment details

Breeze

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions