From a16ef9f1ea82b62c15ea314bf4286b049b0bef91 Mon Sep 17 00:00:00 2001 From: Roc <30228238+sljlp@users.noreply.github.com> Date: Wed, 26 Oct 2022 20:03:29 +0800 Subject: [PATCH] fix a bug that print log twice (#47336) (#47343) --- python/paddle/distributed/utils/log_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/paddle/distributed/utils/log_utils.py b/python/paddle/distributed/utils/log_utils.py index 01687fc28d1..c00ce9b8278 100644 --- a/python/paddle/distributed/utils/log_utils.py +++ b/python/paddle/distributed/utils/log_utils.py @@ -18,7 +18,10 @@ import logging def get_logger(log_level, name="root"): logger = logging.getLogger(name) + # Avoid printing multiple logs + logger.propagate = False + if not logger.handlers: log_handler = logging.StreamHandler() logger.setLevel(log_level) -- GitLab