Skip to main content

How to Read a Task Log in the Apache Airflow® UI

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

Everything an Apache Airflow® task writes, through Python's logging or with a plain print(), ends up in that task's log. In the Airflow 3 UI, the log has numbered lines, collapsible groups and a filter by level. This guide opens one, finds a print() line that isn't where you'd expect it, and filters the log down to warnings, on Airflow 3.4.0.

Prerequisites​

  • Apache Airflow® running, and a Dag that has run at least once.

The Example Task​

This guide reads the log of a small Dag whose only task logs two lines and prints one:

dags/hello_logs.py
import logging

from airflow.sdk import dag, task

log = logging.getLogger(__name__)


@dag(schedule=None, tags=["demo"])
def hello_logs():
@task
def count_files():
log.info("Counting the files in the inbox")
log.warning("The inbox has more than 100 files")
print("Done counting")

count_files()


hello_logs()

The hello_logs.py Dag file in an editor window: a logger, and the count_files task that logs an info line, logs a warning and prints Done counting.

Step 1: Open the Log​

Open the Dag, click the run's square for the task in the grid on the left, and stay on the Logs tab:

The count_files task instance page: Success in 1.23 seconds, the Logs tab with All Log Levels, and the log with collapsed groups Log message source details and Pre Execute, the INFO line Counting the files in the inbox, the WARNING line The inbox has more than 100 files, INFO Done. Returned value was: None, and a collapsed Post Execute group.

Each line has a number, a timestamp, a level and the message:

LineWhere it came from
INFO - Counting the files in the inboxlog.info(...) in the task
WARNING - The inbox has more than 100 fileslog.warning(...), highlighted in yellow
INFO - Done. Returned value was: NoneAirflow itself, after the task's function returned

The rows starting with ▶ are collapsed groups that Airflow adds around your task's own lines; click a group's name to expand it. The numbering starts at 4 here because lines 1 to 3 are inside the collapsed groups.

Step 2: Find the print() Output​

The Done counting line from print() isn't between the others. Click Post Execute at the bottom:

The same log with the Post Execute group expanded, showing line 7, INFO - Done counting, after the Done. Returned value was: None line.

There it is, as line 7, after Airflow's Done. line, and shown at the INFO level. Airflow collects what a task prints separately from its log calls, and in my run those lines arrived after the task had finished, so the UI grouped them under Post Execute. If a print() seems to be missing, look there.

Step 3: Filter by Level​

Click All Log Levels:

The All Log Levels menu open: All Log Levels checked, then DEBUG, INFO, WARNING, ERROR and CRITICAL.

Pick WARNING, then press Escape to close the menu:

The log filtered to WARNING: only line 5, WARNING - The inbox has more than 100 files, under the task identity line.

Only the warning is left. In a long log, this is the quickest way to find what went wrong. The × in the filter box removes the filter again.

Common Mistakes​

MistakeWhat happensDo this instead
Looking for print() lines between the log linesThey're not thereExpand Post Execute
Expecting a print() line to show up under a WARNING filterPrinted lines are shown as INFOUse log.warning(...) for warnings

Troubleshooting​

SymptomLikely causeFix
Your print() line is missingIt's inside the collapsed Post Execute groupExpand it

FAQ​

Should I use print() or logging in a task?​

Both end up in the log, but a print() line is always shown as INFO. With logging you choose the level, such as WARNING, which is what the level filter goes by.

Where are the log files on disk?​

In the logs folder of your AIRFLOW_HOME. This one is logs/dag_id=hello_logs/run_id=manual__2026-12-01T04:30:00.712410+00:00/task_id=count_files/attempt=1.log: a folder per Dag, run and task, and a file per attempt.

Conclusion​

The count_files log showed its INFO and WARNING lines in order, numbered, with Airflow's own Done. line after them. The print() line was in the collapsed Post Execute group, and the WARNING filter cut the log down to the one warning.

Additional Resources​

Apache®, Apache Airflow and Airflow® are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. No endorsement by The Apache Software Foundation is implied by the use of these marks.