0

Glog no INFO level terminal output

Logger4me::Logger4me(const char* app_name) {
    **google::InitGoogleLogging(app_name);**
    boost::filesystem::path currentPath = boost::filesystem::current_path();
    boost::filesystem::path log_folder = "log";
    if (!boost::filesystem::exists(log_folder) || boost::filesystem::is_regular_file(log_folder)) {
        boost::filesystem::create_directory(log_folder);
    }
    std::string currenTime = this->getTime();
    std::string log_file = boost::str(boost::format ("%1%/%2%_%3%") % log_folder.string() % app_name % currenTime);
    google::SetLogFilenameExtension(".log");
    google::SetLogDestination(google::GLOG_INFO, log_file.data());
    FLAGS_timestamp_in_logfile_name = false;
    FLAGS_minloglevel = google::GLOG_INFO;
    std::set_terminate(&Logger4me::myTerminater);
}

This is my code and i found that no INFO level logs are printed in my terminal(only found ERRRO or higher levels), i checked everything but still cannot locate the problem. One clue i found is that if i comment out the first line of initializing, the logs will be redirected to stderr and i can find my INFO logs there. PS: Logging into files works well

1 Answers1

0

I kept assuming that the default stderr level of Glog is INFO as I was told on the internet but, after adding the following in my code, my problem got solved:

FLAGS_stderrthreshold = google::GLOG_INFO;
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83