Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google glog rolling files

Tags:

c++

logging

glog

I'm want to use google-glog (logging library) in my C++\Linux project. And one of the most important feature for me, it's rolling files. I.e. when log file size become more than fixed threshold, creates new log file and old was removed. Same for time limit (daily, hourly etc).

Maybe I missed something, but I can't find such functionality in this very good library. Can somebody help me with this problem?

like image 869
Artem Agasiev Avatar asked May 08 '13 11:05

Artem Agasiev


1 Answers

For logfile size(Integer):

GLOG_max_log_size(Environmental variable) OR --max_log_size=size(if gflags is installed) OR fLI::FLAGS_max_log_size=size(in C++ code)

For logdir(Strings):

GLOG_log_dir(Environmental variable) OR --log_dir=dir(if gflags is installed) OR fLS::FLAGS_log_dir=logdir(in C++ code)

For logging to stderr(Boolean):

GLOG_logtostderr(Environmental variable) OR --logtostderr=1(if gflags is installed) OR fLB::logtostderr=true(in C++ code)

Likewise you can use following also:

  • alsologtostderr, colorlogtostderr, log_prefix, stop_logging_if_full_disk from namespace fLB (all are Boolean)
  • minloglevel, logbuflevel, logbufsecs, logemaillevel from namespace fLI (all are Integers)
  • alsologtoemail, logmailer, log_link, log_backtrace_at from namespace fLS (all are Strings)

But above all do have a look on to glog_srource/src/logging.cc for more information as quamrana said.

like image 125
bikram990 Avatar answered Oct 06 '22 08:10

bikram990