### Apache Airflow version

2.4.1

### What happened

![image](https://user-images.githubusercontent.com/24224756/194797283-6c26ad63-d432-4c41-9f91-2dbc47417ec7.png)
when the sensor running, I can see the log above, but when I manual set the task state to failed or the task failed by other reason, I can't see log at here
![image](https://user-images.githubusercontent.com/24224756/194797633-0c7bf825-8e83-42af-8298-03491a26b7c9.png)
In other version airflow, like 2.3/2.2, this still happens

### What you think should happen instead

_No response_

### How to reproduce

_No response_

### Operating System

Ubuntu 20.04.4 LTS (Focal Fossa)

### Versions of Apache Airflow Providers

_No response_

### Deployment

Docker-Compose

### Deployment details

_No response_

### Anything else

_No response_

### Are you willing to submit PR?

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

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

dag: DAG, execution_date: datetime, future: bool, past: bool, *, session: SASession = NEW_SESSION
) -> list[datetime]:
    """Return DAG execution dates."""
    latest_execution_date = dag.get_latest_execution_date(session=session)
    if latest_execution_date is None:
        raise ValueError(f"Received non-localized date {execution_date}")
    execution_date = timezone.coerce_datetime(execution_date)
    
    end_date = latest_execution_date if future else execution_date
    if dag.start_date:
        start_date = dag.start_date
    else:
        start_date = execution_date
    start_date = execution_date if not past else start_date
    if not dag.timetable.can_run:
        
        
        dag_runs = dag.get_dagruns_between(start_date=start_date, end_date=end_date)
        dates = sorted({d.execution_date for d in dag_runs})
    elif not dag.timetable.periodic:
        dates = [start_date]
    else:
        dates = [
            info.logical_date for info in dag.iter_dagrun_infos_between(start_date, end_date, align=False)
        ]
    return dates
@provide_session
def get_run_ids(dag: DAG, run_id: str, future: bool, past: bool, session: SASession = NEW_SESSION):