Add warning message when initialize GLOG failed. (#21487)

Add warning message when initialize GLOG failed
paddle_tiny_install
Huihuang Zheng 6 years ago committed by GitHub
parent b3090ad406
commit a71f53d7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -47,6 +47,7 @@ namespace framework {
std::once_flag gflags_init_flag;
std::once_flag p2p_init_flag;
std::once_flag glog_warning_once_flag;
void InitGflags(std::vector<std::string> argv) {
std::call_once(gflags_init_flag, [&]() {
@ -202,6 +203,15 @@ void InitDevices(bool init_p2p, const std::vector<int> devices) {
void SignalHandle(const char *data, int size) {
auto file_path = string::Sprintf("/tmp/paddle.%d.dump_info", ::getpid());
try {
// The signal is coming line by line but we print general guide just once
std::call_once(glog_warning_once_flag, [&]() {
LOG(WARNING) << "Initialize GLOG failed, PaddlePaddle may not be able to "
"print GLOG\n";
LOG(WARNING) << "You could check whether you killed GLOG initialize "
"process or PaddlePaddle process accidentally\n";
LOG(WARNING) << "The detail failure signal is:\n\n";
});
LOG(WARNING) << std::string(data, size);
std::ofstream dump_info;
dump_info.open(file_path, std::ios::app);

Loading…
Cancel
Save