From a6433f8bdab50c2e875f9640f14cad41dd2bfb8a Mon Sep 17 00:00:00 2001 From: Pei Yang Date: Thu, 5 Dec 2019 20:16:35 +0800 Subject: [PATCH] cherry-pick fix muting glog warning message, test=release/1.6 (#21576) --- paddle/fluid/inference/api/analysis_predictor.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/inference/api/analysis_predictor.cc b/paddle/fluid/inference/api/analysis_predictor.cc index 4e8d2094e2..6319d99ab8 100644 --- a/paddle/fluid/inference/api/analysis_predictor.cc +++ b/paddle/fluid/inference/api/analysis_predictor.cc @@ -477,6 +477,10 @@ void AnalysisPredictor::OptimizeInferenceProgram() { template <> std::unique_ptr CreatePaddlePredictor< AnalysisConfig, PaddleEngineKind::kAnalysis>(const AnalysisConfig &config) { + if (config.glog_info_disabled()) { + FLAGS_logtostderr = 1; + FLAGS_minloglevel = 2; // GLOG_ERROR + } VLOG(3) << "create AnalysisConfig"; PADDLE_ENFORCE(config.is_valid(), "Note: Each config can only be used for one predictor."); @@ -508,11 +512,6 @@ std::unique_ptr CreatePaddlePredictor< framework::InitGflags(flags); } } - framework::InitGLOG(""); - if (config.glog_info_disabled()) { - FLAGS_logtostderr = 1; - FLAGS_minloglevel = 2; // GLOG_ERROR - } std::unique_ptr predictor(new AnalysisPredictor(config)); // Each config can only be used for one predictor. -- GitLab