From 202e7a49013e8f89bc5bfa8225cdb45b196f7bb6 Mon Sep 17 00:00:00 2001 From: Valuebai <745919068@qq.com> Date: Fri, 14 May 2021 09:46:05 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E8=A7=A3=E5=86=B3=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=89=93=E5=8D=B0=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20log=5Flogger.handlers.clear()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/logConf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conf/logConf.py b/conf/logConf.py index a46ea05..406bc80 100644 --- a/conf/logConf.py +++ b/conf/logConf.py @@ -248,6 +248,8 @@ class GetLogger: """在logger中添加日志句柄并返回,如果logger已有句柄,则直接返回""" # 实例化root日志对象 log_logger = logging.getLogger('root') + # 解决日志重复打印的问题 + log_logger.handlers.clear() # 设置日志的输出级别 log_logger.setLevel(self.logs_level)