Commit 01db0197 by William Dauchy Committed by Stéphane Graber

log: fix quiet mode

quiet mode was overriden by the double call of lxc_log_init see lxc_container_new use lxc_log_options_no_override in order to fix this Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Signed-off-by: 's avatarWilliam Dauchy <william@gandi.net>
parent d96b7d0e
...@@ -49,10 +49,12 @@ static __thread char *log_fname = NULL; ...@@ -49,10 +49,12 @@ static __thread char *log_fname = NULL;
*/ */
static __thread int lxc_logfile_specified = 0; static __thread int lxc_logfile_specified = 0;
static __thread int lxc_loglevel_specified = 0; static __thread int lxc_loglevel_specified = 0;
static __thread int lxc_quiet_specified = 0;
#else #else
int lxc_log_fd = -1; int lxc_log_fd = -1;
static char log_prefix[LXC_LOG_PREFIX_SIZE] = "lxc"; static char log_prefix[LXC_LOG_PREFIX_SIZE] = "lxc";
static char *log_fname = NULL; static char *log_fname = NULL;
static int lxc_quiet_specified = 0;
/* command line values for logfile or logpriority should always override /* command line values for logfile or logpriority should always override
* values from the configuration file or defaults * values from the configuration file or defaults
*/ */
...@@ -316,10 +318,12 @@ extern int lxc_log_init(const char *name, const char *file, ...@@ -316,10 +318,12 @@ extern int lxc_log_init(const char *name, const char *file,
lxc_priority = lxc_log_priority_to_int(priority); lxc_priority = lxc_log_priority_to_int(priority);
lxc_log_category_lxc.priority = lxc_priority; lxc_log_category_lxc.priority = lxc_priority;
lxc_log_category_lxc.appender = &log_appender_logfile;
if (!quiet) if (!lxc_quiet_specified) {
lxc_log_category_lxc.appender->next = &log_appender_stderr; lxc_log_category_lxc.appender = &log_appender_logfile;
if (!quiet)
lxc_log_category_lxc.appender->next = &log_appender_stderr;
}
if (prefix) if (prefix)
lxc_log_set_prefix(prefix); lxc_log_set_prefix(prefix);
...@@ -438,4 +442,6 @@ extern void lxc_log_options_no_override() ...@@ -438,4 +442,6 @@ extern void lxc_log_options_no_override()
if (lxc_log_get_level() != LXC_LOG_PRIORITY_NOTSET) if (lxc_log_get_level() != LXC_LOG_PRIORITY_NOTSET)
lxc_loglevel_specified = 1; lxc_loglevel_specified = 1;
lxc_quiet_specified = 1;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment