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: 's avatarFelix Abecassis <fabecassis@nvidia.com> Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 07b6e2e6
...@@ -595,6 +595,7 @@ on_error: ...@@ -595,6 +595,7 @@ on_error:
int lxc_init(const char *name, struct lxc_handler *handler) int lxc_init(const char *name, struct lxc_handler *handler)
{ {
const char *loglevel;
struct lxc_conf *conf = handler->conf; struct lxc_conf *conf = handler->conf;
lsm_init(); lsm_init();
...@@ -635,8 +636,9 @@ int lxc_init(const char *name, struct lxc_handler *handler) ...@@ -635,8 +636,9 @@ int lxc_init(const char *name, struct lxc_handler *handler)
if (setenv("LXC_CGNS_AWARE", "1", 1)) if (setenv("LXC_CGNS_AWARE", "1", 1))
SYSERROR("Failed to set environment variable LXC_CGNS_AWARE=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)) loglevel = lxc_log_priority_to_string(lxc_log_get_level());
SYSERROR("Failed to set environment variable LXC_CGNS_AWARE=1."); 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. */ /* End of environment variable setup for hooks. */
TRACE("set environment variables"); TRACE("set environment variables");
......
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