From c3a2cdccafb05bb99190e08b83a221411caf59be Mon Sep 17 00:00:00 2001 From: kuizhiqing Date: Thu, 4 Aug 2022 10:53:17 +0800 Subject: [PATCH] fix logger pollution (#44857) --- python/paddle/distributed/ps/coordinator.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/paddle/distributed/ps/coordinator.py b/python/paddle/distributed/ps/coordinator.py index 441ace1683..a012f338a5 100755 --- a/python/paddle/distributed/ps/coordinator.py +++ b/python/paddle/distributed/ps/coordinator.py @@ -23,10 +23,13 @@ import abc import os import logging -logging.basicConfig( - format='%(asctime)s %(levelname)-2s [%(filename)s:%(lineno)d] %(message)s', - level=logging.INFO) logger = logging.getLogger(__name__) +logger.setLevel(logging.INFO) +formatter = logging.Formatter( + fmt='%(asctime)s %(levelname)-2s [%(filename)s:%(lineno)d] %(message)s') +ch = logging.StreamHandler() +ch.setFormatter(formatter) +logger.addHandler(ch) class ClientInfoAttr: -- GitLab