The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2004

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
We want the loglevel that the user specified when starting the container
because it overrides the default one set in the config.

Closes #2003.

Reported-by: Felix Abecassis <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
From 9c24e367bbf4715444748865933a68a1954ec0e3 Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Wed, 6 Dec 2017 00:16:38 +0100
Subject: [PATCH] start: set loglevel correctly

We want the loglevel that the user specified when starting the container
because it overrides the default one set in the config.

Closes #2003.

Reported-by: Felix Abecassis <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
---
 src/lxc/start.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lxc/start.c b/src/lxc/start.c
index a6bb80325..00510ce21 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -572,6 +572,7 @@ struct lxc_handler *lxc_init_handler(const char *name, 
struct lxc_conf *conf,
 
 int lxc_init(const char *name, struct lxc_handler *handler)
 {
+       char *loglevel;
        struct lxc_conf *conf = handler->conf;
 
        lsm_init();
@@ -612,8 +613,9 @@ int lxc_init(const char *name, struct lxc_handler *handler)
        if (setenv("LXC_CGNS_AWARE", "1", 1))
                SYSERROR("Failed to set environment variable 
LXC_CGNS_AWARE=1.");
 
-       if (setenv("LXC_LOG_LEVEL", 
lxc_log_priority_to_string(handler->conf->loglevel), 1))
-               SYSERROR("Failed to set environment variable 
LXC_CGNS_AWARE=1.");
+       loglevel = lxc_log_priority_to_string(lxc_log_get_level());
+       if (setenv("LXC_LOG_LEVEL", loglevel, 1))
+               SYSERROR("Failed to set environment variable LXC_LOG_LEVEL=%s", 
loglevel);
        /* End of environment variable setup for hooks. */
 
        TRACE("set environment variables");
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to