Merge pull request #1857 from RainFrost1/release/2.3

cherry-pick fix log twice bug for release2.3
pull/1862/head
cuicheng01 2022-04-21 11:19:33 +08:00 committed by GitHub
commit 925619fca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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):

View File

@ -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):