diff --git a/ppocr/utils/logging.py b/ppocr/utils/logging.py index ce827e8b10c4b63b736886a2f72106c7570576b1..1eac8f351a4d30915d6f4ca863267cb73b9b1f19 100644 --- a/ppocr/utils/logging.py +++ b/ppocr/utils/logging.py @@ -26,7 +26,7 @@ logger_initialized = {} @functools.lru_cache() -def get_logger(name='root', log_file=None, log_level=logging.DEBUG): +def get_logger(name='ppocr', log_file=None, log_level=logging.DEBUG): """Initialize and get a logger by name. If the logger has not been initialized, this method will initialize the logger by adding one or two handlers, otherwise the initialized logger will @@ -67,4 +67,5 @@ def get_logger(name='root', log_file=None, log_level=logging.DEBUG): else: logger.setLevel(logging.ERROR) logger_initialized[name] = True + logger.propagate = False return logger diff --git a/test_tipc/supplementary/config.py b/test_tipc/supplementary/config.py index d0dce227ef1f1a57780b36cb7f9f60acfe6afc36..72a99c70af4dfb7b2d43e6a3bf34e4b3db10d8db 100644 --- a/test_tipc/supplementary/config.py +++ b/test_tipc/supplementary/config.py @@ -122,7 +122,7 @@ def preprocess(is_train=False): log_file = '{}/train.log'.format(save_model_dir) else: log_file = None - logger = get_logger(name='root', log_file=log_file) + logger = get_logger(log_file=log_file) # check if set use_gpu=True in paddlepaddle cpu version use_gpu = config['use_gpu'] diff --git a/tools/infer_vqa_token_ser_re.py b/tools/infer_vqa_token_ser_re.py index 1e5f6f76d6b0599089069ab30f76b3479c7c90b4..2c7cb5e4251819c53e56ba74df530181836299a2 100755 --- a/tools/infer_vqa_token_ser_re.py +++ b/tools/infer_vqa_token_ser_re.py @@ -151,7 +151,7 @@ def preprocess(): ser_config = load_config(FLAGS.config_ser) ser_config = merge_config(ser_config, FLAGS.opt_ser) - logger = get_logger(name='root') + logger = get_logger() # check if set use_gpu=True in paddlepaddle cpu version use_gpu = config['Global']['use_gpu'] diff --git a/tools/program.py b/tools/program.py index 7ff04b41513a9ddec5c8888ac6c5ded7b8527b43..8ec152bb92f0855d44b2597ce2420b16a4fa007e 100755 --- a/tools/program.py +++ b/tools/program.py @@ -525,7 +525,7 @@ def preprocess(is_train=False): log_file = '{}/train.log'.format(save_model_dir) else: log_file = None - logger = get_logger(name='root', log_file=log_file) + logger = get_logger(log_file=log_file) # check if set use_gpu=True in paddlepaddle cpu version use_gpu = config['Global']['use_gpu']