impstuffsforcse
impstuffsforcse

Reputation: 129

Airflow DAG script print the value in logs

Actually I was passing JSON {"Column": "ABC123"} in Airflow before triggering it and in DAG script

I have written the code as below in DAG script

 variable1 = "['Column']"
 variable2 = variable1[3:6]

 print( {variable2} )

Actually I want to print the value as 123 in Airflow logs but it is not printing in the logs...DAG runs successful but not able to print the value in logs whatever I passed to column while triggering DAG

Upvotes: 0

Views: 4861

Answers (1)

What I use to see the logs inside the Airflow GUI is the library loggings, already inside Python.

You could try using, as an example: logging.info(var2)

Documentation: https://docs.python.org/3/library/logging.html

PD: Printing sth (Using basic print) is shown in my Airflow GUI logs, so not sure if this will help.

Upvotes: 2

Related Questions