diff --git a/ppcls/engine/engine.py b/ppcls/engine/engine.py index 8d077b9d8dbe9feb8303198115e87b603d052c00..019cf165054a080e6d3883e5b01e3281ebd1d19e 100644 --- a/ppcls/engine/engine.py +++ b/ppcls/engine/engine.py @@ -71,7 +71,7 @@ class Engine(object): self.output_dir = self.config['Global']['output_dir'] log_file = os.path.join(self.output_dir, self.config["Arch"]["name"], f"{mode}.log") - init_logger(name='root', log_file=log_file) + init_logger(log_file=log_file) print_config(config) # init train_func and eval_func diff --git a/ppcls/static/train.py b/ppcls/static/train.py index 1961dfaf32e25740bdd84dd24a3b10b16f4b1d2c..dd16cdb4caa41671d8f9979fea32e49611cf6ab0 100644 --- a/ppcls/static/train.py +++ b/ppcls/static/train.py @@ -71,7 +71,7 @@ def main(args): log_file = os.path.join(global_config['output_dir'], config["Arch"]["name"], f"{mode}.log") - init_logger(name='root', log_file=log_file) + init_logger(log_file=log_file) print_config(config) if global_config.get("is_distributed", True): diff --git a/ppcls/utils/logger.py b/ppcls/utils/logger.py index d4faaa9b0cd77b6038b40277cc62b4c6981f2da4..bc8de364091e9b56dafdcffa4475f7f225306e1b 100644 --- a/ppcls/utils/logger.py +++ b/ppcls/utils/logger.py @@ -22,7 +22,7 @@ import paddle.distributed as dist _logger = None -def init_logger(name='root', log_file=None, log_level=logging.INFO): +def init_logger(name='ppcls', log_file=None, log_level=logging.INFO): """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 @@ -59,6 +59,7 @@ def init_logger(name='root', log_file=None, log_level=logging.INFO): _logger.setLevel(log_level) else: _logger.setLevel(logging.ERROR) + _logger.propagate = False def log_at_trainer0(log):