korex-f commented on code in PR #66633:
URL: https://github.com/apache/airflow/pull/66633#discussion_r3237136547


##########
providers/amazon/src/airflow/providers/amazon/aws/log/cloudwatch_task_handler.py:
##########
@@ -118,16 +119,29 @@ def handler(self) -> watchtower.CloudWatchLogHandler:
             json_serialize_default=_json_serialize or json_serialize_legacy,
         )
 
+    @property
+    def handler(self) -> watchtower.CloudWatchLogHandler:
+        # Defensive self-healing: if the handler was killed by 
logging.shutdown()
+        # (shutting_down=True), recreate it. This can happen if dictConfig() 
is called
+        # after the handler was first created, since dictConfig calls
+        # _clearExistingHandlers() -> logging.shutdown() on all existing 
handlers.

Review Comment:
   Bug 1 fixes the primary trigger, but the self-healing property in Bug 2 is 
defense-in-depth, any future dictConfig() call (from a plugin, test 
reconfiguration, or other code path) would re-kill a cached handler. Happy to 
remove it if the preference is to keep the fix minimal, but I'd argue it makes 
the system more resilient long-term. Open to guidance here.



-- 
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