Skip to content

Commit

Permalink
fix logger problem (#21342) (#21635)
Browse files Browse the repository at this point in the history
* fix logger problem
test=develop

* refine logger
test=develop
  • Loading branch information
xiegegege authored and ccmeteorljh committed Dec 9, 2019
1 parent f7c629d commit 2de1029
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions python/paddle/fluid/trainer_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import logging
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 .device_worker import Hogwild, DownpourSGD, Section
Expand Down Expand Up @@ -109,7 +111,8 @@ def handler_launch_func(self, scope, handler):
if isinstance(fetch_instance.var_dict[key], Variable):
var_name_to_key[fetch_instance.var_dict[key].name] = key
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
elapsed_secs = 0
while True:
Expand All @@ -127,8 +130,8 @@ def handler_launch_func(self, scope, handler):
var = scope.find_var(key)
fetch_dict[key] = var
if var == None:
logging.warning("{} value currently not available".
format(var_name_to_key[key]))
local_logger.warning("{} value currently not available".
format(var_name_to_key[key]))
res_dict = {}
for key in fetch_dict:
user_name = var_name_to_key[key]
Expand Down

0 comments on commit 2de1029

Please sign in to comment.