Updated Branches:
  refs/heads/master 8aa699dfd -> 53f584017

Removed logging to /tmp when --log_dir is ommitted.

The current intialization of glog creates log files in /tmp even when
the log_dir command argument is not passed. Setting FLAGS_logtostderr
to true disables all log file creation/writes.

From: Yuval Pavel Zholkover <paulz...@gmail.com>
Review: https://reviews.apache.org/r/14800


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/53f58401
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/53f58401
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/53f58401

Branch: refs/heads/master
Commit: 53f5840175c359594ec7c7c7ba579ed1cc0bd348
Parents: 1657a84
Author: Benjamin Mahler <bmah...@twitter.com>
Authored: Thu Oct 24 13:59:09 2013 -0700
Committer: Benjamin Mahler <bmah...@twitter.com>
Committed: Thu Oct 24 14:31:07 2013 -0700

----------------------------------------------------------------------
 src/logging/logging.cpp | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/53f58401/src/logging/logging.cpp
----------------------------------------------------------------------
diff --git a/src/logging/logging.cpp b/src/logging/logging.cpp
index 850fb3c..6e71e5e 100644
--- a/src/logging/logging.cpp
+++ b/src/logging/logging.cpp
@@ -95,11 +95,24 @@ void initialize(
               << flags.log_dir.get() << ": " << mkdir.error();
     }
     FLAGS_log_dir = flags.log_dir.get();
+    // Do not log to stderr instead of log files.
+    FLAGS_logtostderr = false;
+  } else {
+    // Log to stderr instead of log files.
+    FLAGS_logtostderr = true;
   }
 
   // Log everything to stderr IN ADDITION to log files unless
   // otherwise specified.
-  if (!flags.quiet) {
+  if (flags.quiet) {
+    FLAGS_stderrthreshold = 3; // FATAL.
+
+    // FLAGS_stderrthreshold is ignored when logging to stderr instead of log 
files.
+    // Setting the minimum log level gets around this issue.
+    if (FLAGS_logtostderr) {
+      FLAGS_minloglevel = 3; // FATAL.
+    }
+  } else {
     FLAGS_stderrthreshold = 0; // INFO.
   }
 

Reply via email to