[libvirt] [PATCH v2 03/10] daemon: Hook up the virLog{Get, Set}DefaultOutput to the daemon's init routine

John Ferlan jferlan at redhat.com
Thu Dec 8 21:41:50 UTC 2016



On 11/25/2016 08:12 AM, Erik Skultety wrote:
> Now that virLog{Get,Set}DefaultOutput routines are introduced we can wire them
> up to the daemon's logging initialization code. Also, change the order of
> operations a bit so that we still strictly honor our precedence of settings:
> cmdline > env > config now that outputs and filters are not appended anymore.
> 
> Signed-off-by: Erik Skultety <eskultet at redhat.com>
> ---
>  daemon/libvirtd.c         | 96 +++++++----------------------------------------
>  src/locking/lock_daemon.c | 90 +++++++-------------------------------------
>  src/logging/log_daemon.c  | 92 +++++++--------------------------------------
>  3 files changed, 40 insertions(+), 238 deletions(-)
> 
> diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
> index 3902a8b..b2e89fd 100644
> --- a/daemon/libvirtd.c
> +++ b/daemon/libvirtd.c
> @@ -675,103 +675,33 @@ daemonSetupLogging(struct daemonConfig *config,
>       * Libvirtd's order of precedence is:
>       * cmdline > environment > config
>       *
> -     * In order to achieve this, we must process configuration in
> -     * different order for the log level versus the filters and
> -     * outputs. Because filters and outputs append, we have to look at
> -     * the environment first and then only check the config file if
> -     * there was no result from the environment. The default output is
> -     * then applied only if there was no setting from either of the
> -     * first two. Because we don't have a way to determine if the log
> -     * level has been set, we must process variables in the opposite
> +     * The default output is applied only if there was no setting from either
> +     * the config or the environment. Because we don't have a way to determine
> +     * if the log level has been set, we must process variables in the opposite
>       * order, each one overriding the previous.
>       */
>      if (config->log_level != 0)
>          virLogSetDefaultPriority(config->log_level);
>  
> +    if (virLogSetDefaultOutput("libvirtd.log", godaemon, privileged) < 0)
> +        return -1;
> +
> +    /* In case the config is empty, the filters become empty and outputs will
> +     * be set to default
> +     */
> +    virLogSetFilters(config->log_filters);
> +    virLogSetOutputs(config->log_outputs);

Existing, but each ignores the return value and could be wrapped that
way too. Repeated for all 3 consumers...  Your call on adding the
ignore_value(); around it.

ACK

John

[...]


> 




More information about the libvir-list mailing list