daemon: Disable logging to console after detaching.
authorBen Pfaff <blp@nicira.com>
Tue, 14 Jun 2011 23:08:59 +0000 (16:08 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 16 Jun 2011 19:28:06 +0000 (12:28 -0700)
When we detach, we replace stderr by /dev/null, so there's no point in
logging to the console after that.  Just turn it off.

lib/daemon.c

index 9c814ea9fd9e61e9efe9913f790ebfd79d59577d..f4151ab1253238b08262a24724f3680b62cfda2c 100644 (file)
@@ -408,6 +408,9 @@ close_standard_fds(void)
         dup2(null_fd, STDOUT_FILENO);
         dup2(null_fd, STDERR_FILENO);
     }
+
+    /* Disable logging to stderr to avoid wasting CPU time. */
+    vlog_set_levels(NULL, VLF_CONSOLE, VLL_EMER);
 }
 
 /* If daemonization is configured, then starts daemonization, by forking and