提交 2de10293 编写于 作者: X xiegegege 提交者: Jinhua Liang

fix logger problem (#21342) (#21635)

* fix logger problem
test=develop

* refine logger
test=develop
上级 f7c629d9
...@@ -18,7 +18,9 @@ import time ...@@ -18,7 +18,9 @@ import time
import logging import logging
import numpy as np import numpy as np
logging.basicConfig() FORMAT = '%(asctime)s-%(levelname)s: %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT)
local_logger = logging.getLogger(__name__)
from .trainer_desc import MultiTrainer, DistMultiTrainer, PipelineTrainer from .trainer_desc import MultiTrainer, DistMultiTrainer, PipelineTrainer
from .device_worker import Hogwild, DownpourSGD, Section from .device_worker import Hogwild, DownpourSGD, Section
...@@ -109,7 +111,8 @@ class FetchHandlerMonitor(object): ...@@ -109,7 +111,8 @@ class FetchHandlerMonitor(object):
if isinstance(fetch_instance.var_dict[key], Variable): if isinstance(fetch_instance.var_dict[key], Variable):
var_name_to_key[fetch_instance.var_dict[key].name] = key var_name_to_key[fetch_instance.var_dict[key].name] = key
else: else:
logging.warning("the value of {} is not a Variable".format(key)) local_logger.warning("the value of {} is not a Variable".format(
key))
var_name_to_key["None.var"] = key var_name_to_key["None.var"] = key
elapsed_secs = 0 elapsed_secs = 0
while True: while True:
...@@ -127,8 +130,8 @@ class FetchHandlerMonitor(object): ...@@ -127,8 +130,8 @@ class FetchHandlerMonitor(object):
var = scope.find_var(key) var = scope.find_var(key)
fetch_dict[key] = var fetch_dict[key] = var
if var == None: if var == None:
logging.warning("{} value currently not available". local_logger.warning("{} value currently not available".
format(var_name_to_key[key])) format(var_name_to_key[key]))
res_dict = {} res_dict = {}
for key in fetch_dict: for key in fetch_dict:
user_name = var_name_to_key[key] user_name = var_name_to_key[key]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册