You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "o-nikolas (via GitHub)" <gi...@apache.org> on 2025/08/27 18:19:12 UTC

[PR] Configure logging for Triggerer [airflow]

o-nikolas opened a new pull request, #54992:
URL: https://github.com/apache/airflow/pull/54992

   This will ensure logging configuration such as colored_console_log are respected by the Triggerer processes.
   
   The way this was detected was Trigger logs not respecting the `logging.colored_console_log` config (see #54962). With this change the logs now respect that setting:
   
   <img width="1913" height="1152" alt="Screenshot from 2025-08-27 11-16-40" src="https://github.com/user-attachments/assets/d311c6b6-80cd-4b81-bd04-0edbb4832e44" />
   
   
   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Configure logging for Triggerer [airflow]

Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas merged PR #54992:
URL: https://github.com/apache/airflow/pull/54992


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Configure logging for Triggerer [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #54992:
URL: https://github.com/apache/airflow/pull/54992#issuecomment-3233891382

   Unless this is pressing, I'm working on a complete overhaul of logging in #52651


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Configure logging for Triggerer [airflow]

Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on PR #54992:
URL: https://github.com/apache/airflow/pull/54992#issuecomment-3229448093

   CC @ashb 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Configure logging for Triggerer [airflow]

Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on code in PR #54992:
URL: https://github.com/apache/airflow/pull/54992#discussion_r2307987515


##########
airflow-core/tests/unit/jobs/test_triggerer_job.py:
##########
@@ -1145,3 +1145,14 @@ def test_update_triggers_prevents_duplicate_creation_queue_entries_with_multiple
     trigger_ids = {trigger.id for trigger in supervisor.creating_triggers}
     assert trigger_orm1.id in trigger_ids
     assert trigger_orm2.id in trigger_ids
+
+
+@patch("airflow.sdk.log.configure_logging")
+def test_process_log_messages_configures_logging(mock_configure_logging, supervisor_builder):
+    supervisor = supervisor_builder()
+
+    # Create the generator (this triggers the configuration reading)
+    log_processor_gen = supervisor._process_log_messages_from_subprocess()
+    next(log_processor_gen)  # Initialize the generator
+
+    assert mock_configure_logging.call_count == 1

Review Comment:
   done



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Configure logging for Triggerer [airflow]

Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on PR #54992:
URL: https://github.com/apache/airflow/pull/54992#issuecomment-3234217669

   > Okay yes, I see. We were using an unconfigured/wrongly configured
   
   Yupp, it was just being used unconfigured, so much of the configuration wasn't being applied to the logger.
   
   Are you happy to approve after the test change?


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Configure logging for Triggerer [airflow]

Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on PR #54992:
URL: https://github.com/apache/airflow/pull/54992#issuecomment-3245987827

   So far I see all the logs I expect to be configured doing so in the Triggerer (though tracebacks in all processes still don't respect the colour configuration). Let's merge this for now since it's tested and at least solving the issues I know of in the Triggerer. We can always continue iterate further if necessary.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Configure logging for Triggerer [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #54992:
URL: https://github.com/apache/airflow/pull/54992#discussion_r2307853201


##########
airflow-core/tests/unit/jobs/test_triggerer_job.py:
##########
@@ -1145,3 +1145,14 @@ def test_update_triggers_prevents_duplicate_creation_queue_entries_with_multiple
     trigger_ids = {trigger.id for trigger in supervisor.creating_triggers}
     assert trigger_orm1.id in trigger_ids
     assert trigger_orm2.id in trigger_ids
+
+
+@patch("airflow.sdk.log.configure_logging")
+def test_process_log_messages_configures_logging(mock_configure_logging, supervisor_builder):
+    supervisor = supervisor_builder()
+
+    # Create the generator (this triggers the configuration reading)
+    log_processor_gen = supervisor._process_log_messages_from_subprocess()
+    next(log_processor_gen)  # Initialize the generator
+
+    assert mock_configure_logging.call_count == 1

Review Comment:
   This test is overly tied to the implementation. As much as it pains me, I think this would be better without a unit test covering it.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Configure logging for Triggerer [airflow]

Posted by "o-nikolas (via GitHub)" <gi...@apache.org>.
o-nikolas commented on code in PR #54992:
URL: https://github.com/apache/airflow/pull/54992#discussion_r2307973510


##########
airflow-core/tests/unit/jobs/test_triggerer_job.py:
##########
@@ -1145,3 +1145,14 @@ def test_update_triggers_prevents_duplicate_creation_queue_entries_with_multiple
     trigger_ids = {trigger.id for trigger in supervisor.creating_triggers}
     assert trigger_orm1.id in trigger_ids
     assert trigger_orm2.id in trigger_ids
+
+
+@patch("airflow.sdk.log.configure_logging")
+def test_process_log_messages_configures_logging(mock_configure_logging, supervisor_builder):
+    supervisor = supervisor_builder()
+
+    # Create the generator (this triggers the configuration reading)
+    log_processor_gen = supervisor._process_log_messages_from_subprocess()
+    next(log_processor_gen)  # Initialize the generator
+
+    assert mock_configure_logging.call_count == 1

Review Comment:
   Yeah, fair enough, happy to drop it!
   



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org