[lxc-devel] quiet mode overriden
William Dauchy
wdauchy at gmail.com
Mon Sep 8 16:41:56 UTC 2014
Hi Serge,
Thank you for your reply.
On Thu, Sep 4, 2014 at 8:19 PM, Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
> Or should lxc_log_options_no_override() be updated to also make
> future lxc_log_init() calls not do the if (!quiet) part?
Do you think this could be acceptable? (not tested yet)
I made the assumption lxc_container_new is always called after the
first correct lxc_log_init
From: William Dauchy <william at gandi.net>
Subject: [PATCH] log: avoid appending stderr as logger when quiet is specified
Signed-off-by: William Dauchy <william at gandi.net>
---
src/lxc/log.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lxc/log.c b/src/lxc/log.c
index b6b3931..c46a68a 100644
--- a/src/lxc/log.c
+++ b/src/lxc/log.c
@@ -49,6 +49,7 @@ static __thread char *log_fname = NULL;
*/
static __thread int lxc_logfile_specified = 0;
static __thread int lxc_loglevel_specified = 0;
+static __thread int lxc_quiet_specified = 0;
#else
int lxc_log_fd = -1;
static char log_prefix[LXC_LOG_PREFIX_SIZE] = "lxc";
@@ -58,6 +59,7 @@ static char *log_fname = NULL;
*/
static int lxc_logfile_specified = 0;
static int lxc_loglevel_specified = 0;
+static int lxc_quiet_specified = 0;
#endif
lxc_log_define(lxc_log, lxc);
@@ -318,7 +320,7 @@ extern int lxc_log_init(const char *name, const char *file,
lxc_log_category_lxc.priority = lxc_priority;
lxc_log_category_lxc.appender = &log_appender_logfile;
- if (!quiet)
+ if (!lxc_quiet_specified && !quiet)
lxc_log_category_lxc.appender->next = &log_appender_stderr;
if (prefix)
@@ -438,4 +440,6 @@ extern void lxc_log_options_no_override()
if (lxc_log_get_level() != LXC_LOG_PRIORITY_NOTSET)
lxc_loglevel_specified = 1;
+
+ lxc_quiet_specified = 1;
}
--
2.1.0
--
William
More information about the lxc-devel
mailing list