jason810496 commented on code in PR #68779:
URL: https://github.com/apache/airflow/pull/68779#discussion_r3456705152
##########
providers/amazon/src/airflow/providers/amazon/aws/log/cloudwatch_task_handler.py:
##########
@@ -127,16 +141,19 @@ def processors(self) -> tuple[structlog.typing.Processor,
...]:
logRecordFactory = getLogRecordFactory()
# The handler MUST be initted here, before the processor is actually
used to log anything.
# Otherwise, logging that occurs during the creation of the handler
can create infinite loops.
- _handler = self.handler
+ _ = self.handler
from airflow.sdk.log import relative_path_from_logger
def proc(logger: structlog.typing.WrappedLogger, method_name: str,
event: structlog.typing.EventDict):
if not logger or not (stream_name :=
relative_path_from_logger(logger)):
return event
+ # Resolve the handler on every record: configure_logging() may have
+ # closed the one built above, in which case ``handler`` rebuilds
it.
+ handler = self.handler
Review Comment:
Each `self.handler` call _might_ create a new instance. So I prefer to keep
the `handler = self.handler` here to ensure we will only access the same
instance within the whole lifecycle of `proc` callable.
--
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]