You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 10:51:11 UTC

svn commit: r1132150 - /incubator/mesos/trunk/src/common/logging.cpp

Author: benh
Date: Sun Jun  5 08:51:11 2011
New Revision: 1132150

URL: http://svn.apache.org/viewvc?rev=1132150&view=rev
Log:
Made log buffer interval configurable and made it default to 0 seconds.
This makes Mesos behave more as expected out of the box, outputting all
lines to the log file when they are written. Unfortunately, the old
default logbufsecs value of 1 didn't do this because Google Log doesn't
actually flush logs this often if you aren't repeatedly writing messages
(see http://code.google.com/p/google-glog/issues/detail?id=52). It might
be nice to have a thread periodically flush the log until glog fixes
this issue, but for now it's good to have a default behavior that's
sensible.

Modified:
    incubator/mesos/trunk/src/common/logging.cpp

Modified: incubator/mesos/trunk/src/common/logging.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/logging.cpp?rev=1132150&r1=1132149&r2=1132150&view=diff
==============================================================================
--- incubator/mesos/trunk/src/common/logging.cpp (original)
+++ incubator/mesos/trunk/src/common/logging.cpp Sun Jun  5 08:51:11 2011
@@ -15,6 +15,9 @@ void Logging::registerOptions(Configurat
   conf->addOption<bool>("quiet", 'q', "Disable logging to stderr", false);
   conf->addOption<string>("log_dir",
                           "Where to put logs (default: MESOS_HOME/logs)");
+  conf->addOption<int>("log_buf_secs",
+                       "How many seconds to buffer log messages for\n",
+                       0);
 }
 
 
@@ -28,7 +31,7 @@ void Logging::init(const char* programNa
     }
     FLAGS_log_dir = logDir;
   }
-  FLAGS_logbufsecs = 1;
+  FLAGS_logbufsecs = conf.get<int>("log_buf_secs", 0);
   google::InitGoogleLogging(programName);
 
   if (!isQuiet(conf))