#include <iostream>
#include <glog/logging.h>
int main(int argc, char* argv[]) {
google::InitGoogleLogging(argv[0]);
//FLAGS_log_dir = "/home/zp/logs/";
//google::SetLogDestination(google::GLOG_INFO, "/home/logs/");
google::SetStderrLogging(google::GLOG_INFO);
FLAGS_colorlogtostderr = true;
"hello world";
FLAGS_stop_logging_if_full_disk = true;
LOG(INFO) << "hello world";
LOG(WARNING)<<"hello world";
LOG(ERROR) <<"hello world";
std::cout<<"wat??"<<std::endl;
google::ShutdownGoogleLogging();
return 0;
}
注意加入
google::SetStderrLogging(google::GLOG_INFO);
和google::ShutdownGoogleLogging();
应该可以不用设置google::SetLogDestination(google::GLOG_INFO, “/home/logs/”)日志文件输出路径/home/logs/