dondaum commented on PR #40171:
URL: https://github.com/apache/airflow/pull/40171#issuecomment-2205756792

   Whenever `StandardTaskRunner()` is initialized, all parent classes including 
[LoggingMixin](https://github.com/apache/airflow/blob/main/airflow/utils/log/logging_mixin.py#L68)
 are initialized. 
   
   LoggingMixin is using `_set_context()`, which ultimately calls 
`set_context()`. This is done 
[here](https://github.com/apache/airflow/blob/main/airflow/utils/log/logging_mixin.py#L258).
 
   
   Importantly, this feature disables log propagation for all loggers by 
default unless the handler specifically requests to keep it. The handler 
`FileTaskHandler` disables log propagatio for the `StandardTaskRunner` logger. 
As a result, no logs are passed to the root logger. Logically, the logs are not 
routed to the LogCaptureHandler added by pytest to the root logger.
   
   We have two ways to deal with this: 
   - Fix provider openlineage testing by either mocking `set_context` or 
enabling log propagation after the test run
   - Using the existing fixture 
"@pytest.mark.usefixtures("reset_logging_config")` in my Postgres tests. This 
will reset the entire log configuration and all loggers.
   
   In my opinion it is better to use the existing fixture. First, it avoids 
future tests causing similar side effects. Second, it is already being used for 
other tests.
   
   I will update my tests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to