[lxc-devel] [PATCH] allow setting/getting lxc.loglevel and lxc.logfile via set_config_item/get_config_item API calls

Serge Hallyn serge.hallyn at ubuntu.com
Mon Nov 4 12:23:59 UTC 2013


Quoting S.Çağlar Onur (caglar at 10ur.org):
> Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>

A bit more description would have been appreciated :)  But I think
I see.

We also may want to change it so that the logfile and loglevel
can actually be changed mid-run.  At some point.

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/lxc/log.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lxc/log.c b/src/lxc/log.c
> index 0946e44..e5eb04f 100644
> --- a/src/lxc/log.c
> +++ b/src/lxc/log.c
> @@ -295,13 +295,13 @@ extern int lxc_log_init(const char *name, const char *file,
>  	}
>  
>  	if (priority) {
> -		lxc_loglevel_specified = 1;
> -		lxc_priority = lxc_log_priority_to_int(priority);
> -
>  		if (lxc_priority == LXC_LOG_PRIORITY_NOTSET) {
>  			ERROR("invalid log priority %s", priority);
>  			return -1;
>  		}
> +
> +		lxc_loglevel_specified = 1;
> +		lxc_priority = lxc_log_priority_to_int(priority);
>  	}
>  
>  	lxc_log_category_lxc.priority = lxc_priority;
> @@ -314,9 +314,9 @@ extern int lxc_log_init(const char *name, const char *file,
>  		lxc_log_set_prefix(prefix);
>  
>  	if (file) {
> -		lxc_logfile_specified = 1;
>  		if (strcmp(file, "none") == 0)
>  			return 0;
> +		lxc_logfile_specified = 1;
>  		ret = __lxc_log_set_file(file, 1);
>  	} else {
>  		ret = -1;
> @@ -362,6 +362,7 @@ extern int lxc_log_set_level(int level)
>  		ERROR("invalid log priority %d", level);
>  		return -1;
>  	}
> +	lxc_loglevel_specified = 1;
>  	lxc_log_category_lxc.priority = level;
>  	return 0;
>  }
> @@ -390,6 +391,7 @@ extern int lxc_log_set_file(const char *fname)
>  {
>  	if (lxc_logfile_specified)
>  		return 0;
> +	lxc_logfile_specified = 1;
>  	return __lxc_log_set_file(fname, 0);
>  }
>  
> -- 
> 1.8.3.2
> 
> 
> ------------------------------------------------------------------------------
> Android is increasing in popularity, but the open development platform that
> developers love is also attractive to malware creators. Download this white
> paper to learn more about secure code signing practices that can help keep
> Android apps secure.
> http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list