如何更改 Google glog 中的输出目录?
我只找到了 google::SetLogDestination(google::LogSeverity, const char* path)
尝试过:
google::SetLogDestination(ERROR, "C:\\log\\error.log);
google::InitGoogleLogging("Test");
LOG(ERROR) << "TEST";
但什么都没写!
顺便说一句:如果您建议另一个轻量级、易于使用且线程安全的库,请告诉我!
感谢您的帮助!
最佳答案
您还可以执行以下操作之一:
只要安装了 GFlgas 库,就将日志目录作为命令行参数传递:
./your_application --log_dir=/some/log/directory
如果您不想在命令行中传递它而是在源代码中设置它:
FLAGS_log_dir = "/some/log/directory";
如果未安装 Google gflags 库,您可以将其设置为环境变量:
GLOG_log_dir=/some/log/directory ./your_application
关于c++ - 更改 Google glog 中的日志记录目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19291499/