[libvirt] [PATCH] util: Remove logging handlers in virExec

Daniel P. Berrange berrange at redhat.com
Tue Jan 12 20:46:33 UTC 2010


On Tue, Jan 12, 2010 at 03:26:26PM -0500, Cole Robinson wrote:
> This allows debug statements and raised errors in hook functions to
> actually be logged somewhere (stderr). Users can enable debugging in the
> daemon and now see more info in /var/log/libvirt/...
> 
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>  src/util/util.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/src/util/util.c b/src/util/util.c
> index 44a4b2f..23d781d 100644
> --- a/src/util/util.c
> +++ b/src/util/util.c
> @@ -334,6 +334,7 @@ __virExec(virConnectPtr conn,
>      int pipeerr[2] = {-1,-1};
>      int childout = -1;
>      int childerr = -1;
> +    int logprio;
>      sigset_t oldmask, newmask;
>      struct sigaction sig_action;
>  
> @@ -452,6 +453,11 @@ __virExec(virConnectPtr conn,
>         of being seen / logged */
>      virSetErrorFunc(NULL, NULL);
>  
> +    /* Make sure any hook logging is sent to stderr */
> +    logprio = virLogGetDefaultPriority();
> +    virLogReset();
> +    virLogSetDefaultPriority(logprio);
> +

I'm not sure that I understand this - surely the child process is already
inheriting this setup from the parent libvirtd ?

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list