uranusjr commented on code in PR #30485:
URL: https://github.com/apache/airflow/pull/30485#discussion_r1166046760


##########
airflow/cli/commands/celery_command.py:
##########
@@ -96,6 +100,32 @@ def _serve_logs(skip_serve_logs: bool = False):
         sub_proc.terminate()
 
 
+@after_setup_logger.connect()
+def logger_setup_handler(logger, **kwargs):
+    """Reconfigure the logger:
+    * logs of severity error, and above goes to stderr,
+    * logs of severity lower than error goes to stdout.
+    """
+    if conf.getboolean("logging", "celery_logging_split", fallback=False):
+        celery_formatter = logging.Formatter(DEFAULT_TASK_LOG_FMT)
+
+        class NoErrorOrAboveFilter(logging.Filter):
+            """Allow only logs with level warning or lower to be reported."""
+
+            def filter(self, record):
+                return record.levelno <= logging.WARNING

Review Comment:
   ```suggestion
           class NoErrorOrAboveFilter(logging.Filter):
               """Allow only logs with level *lower* than ERROR to be 
reported."""
   
               def filter(self, record):
                   return record.levelno < logging.ERROR
   ```



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