airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Airflow 3 Log view displayed incorrectly

Open melicheradam opened this issue 1 month ago • 4 comments

Apache Airflow version

3.1.3

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

3.*

What happened?

If a task fails with exception, the log view cannot be scrolled to the top. If I collapse the exception, I can see extra 5 rows at the top, but still not all of them. Seems like exceptions are not getting their height considered correctly when computing the scroll. In the screenshots below you can see, that the scroll bar is at the top, yet the first line is not number 1

Non-collapsed:

Image Image

Collapsed:

Image Image

What you think should happen instead?

No response

How to reproduce

Print some log lines (at least 20), fail an exception with longer stack trace (at least 15).

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

Deployment details

Irrelevant

Anything else?

No response

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

Code of Conduct

melicheradam avatar Nov 21 '25 10:11 melicheradam

Hi, I would like to work on this issue.

It looks like the problem is related to the log viewer layout not handling long unwrapped lines correctly (possibly missing overflow-wrap or related CSS).

I will investigate and submit a PR with a UI fix.

Lohith625 avatar Nov 28 '25 12:11 Lohith625

Hi, sorry for not updating earlier — I finally got my local setup working and tested this issue.

What I tested

I created a DAG that prints 40+ log lines and then fails with an exception, and observed the log UI in both states:

1) Non-collapsed exception

  • When the exception is expanded, I can scroll to the top and see the first log line without problems

  • So in my case the original symptom (“cannot scroll to the top”) does not appear in this state

(Video showing non-collapsed behavior attached 👇)

https://github.com/user-attachments/assets/77c7eb0e-4a91-489f-959e-a0520140f314

2) Collapsed exception

  • When collapsed, I can also scroll to the top and see the first log line

  • However, if I scroll down and then back up, the exception panel automatically expands itself

(Video showing collapsed behavior attached 👇)

https://github.com/user-attachments/assets/77bf2084-7243-402d-b25b-e12766996bb4

My current understanding

So in my environment:

  • I cannot reproduce the missing-log-lines issue exactly as described,

  • but I can reproduce a related UI issue (collapsed exception auto-expands on scrolling)

Just wanted to confirm:

  • Could the original issue depend on browser, theme, or Airflow version?

  • Do you still experience missing log lines on your setup?

  • Should I address the auto-expand behavior as part of this issue, or should I create a separate issue/PR for it?

Happy to continue working on this 😊

Lohith625 avatar Dec 07 '25 13:12 Lohith625

I am running into a similar issue but it happens without any exceptions in the log file. I can reliably reproduce this issue with Airflow 3.1.3 on an Ubuntu 24.04 system using Firefox 133.0.3.

Here is an example dag that reproduces the problem in my setup. It has one task that logs 100 messages and exits.

import logging
from airflow.sdk import dag, task, timezone

log = logging.getLogger("test_dag")

@dag(
    schedule="5 3 * * *",
    start_date=timezone.datetime(2025, 12, 1),
    catchup=False,
    tags=[]
)
def test_dag():
    @task()
    def collect():
        for i in range(0, 100):
            log.info(f"[Iteration {i}]: Doing some work")

        return None

    collect()

test_dag()

When the vertical scrollbar is at the top of the log area, the first iteration it shows is 33 instead of 0. Image
When the vertical scrollbar is at the bottom of the log area, the last message is shows is 76 instead of 99 Image

Not sure if this helps at all, but I can see the whole log if I use the Firefox Inspector tool to override the position: relative style with position: initial on div.chakra-stack

mbielejeski avatar Dec 08 '25 22:12 mbielejeski

Hey @Lohith625 , thanks for checking the problem.

My browser is Chrome Version 142.0.7444.176 (Official Build) (arm64), running on M1 MacOS

I noticed that the logs start with number 2, is this correct?

melicheradam avatar Dec 09 '25 17:12 melicheradam