o-nikolas commented on code in PR #48774:
URL: https://github.com/apache/airflow/pull/48774#discussion_r2027894764
##########
providers/amazon/src/airflow/providers/amazon/aws/log/cloudwatch_task_handler.py:
##########
@@ -116,8 +116,18 @@ def processors(self) -> tuple[structlog.typing.Processor,
...]:
import structlog.stdlib
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
+ 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)):
Review Comment:
I check for any logger here because I was originally getting None loggers
duplicating each message and causing issues. I'm not entirely sure what was
going on there, but I think this is a safe guard either way.
--
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]