From 2ef8062c9fff307a7dee09322c445e8b1be876b0 Mon Sep 17 00:00:00 2001 From: kuizhiqing Date: Wed, 3 Aug 2022 08:53:51 +0000 Subject: [PATCH] fix logger pollution --- 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 441ace16830d06..a012f338a514fb 100755 --- a/python/paddle/distributed/ps/coordinator.py +++ b/python/paddle/distributed/ps/coordinator.py @@ -23,10 +23,13 @@ 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: