[skip ci] Update code for log on benchmark (#10566)

Signed-off-by: wangting0128 <ting.wang@zilliz.com>
pull/10597/head
wt 2021-10-25 19:27:21 +08:00 committed by GitHub
parent de1cbccb2a
commit 721e82a06e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -13,11 +13,18 @@ def setup_logging(config_path=LOG_CONFIG_PATH, default_level=logging.INFO):
"""
Setup logging configuration
"""
print(FILE_NAME)
print(global_params.log_file_path)
try:
with open(config_path, 'rt') as f:
log_config = yaml.safe_load(f.read())
log_config["handlers"]["info_file_handler"].update({"filename": FILE_NAME})
log_config["handlers"]["info_file_handler"].update({"filename": global_params.log_file_path})
logging.config.dictConfig(log_config)
except Exception:
raise logging.error('Failed to open file', exc_info=True)
class GlobalParams:
log_file_path = FILE_NAME
global_params = GlobalParams()