[libvirt] [PATCH] 4/8 convert virterror to the logging infrastructure

Daniel P. Berrange berrange at redhat.com
Wed Dec 17 17:57:00 UTC 2008


On Wed, Dec 17, 2008 at 05:49:43PM +0100, Daniel Veillard wrote:
> On Wed, Dec 17, 2008 at 04:25:55PM +0000, Daniel P. Berrange wrote:
> > On Wed, Dec 17, 2008 at 04:19:47PM +0100, Daniel Veillard wrote:
> > >   Basically having the debug information in one place and the errors
> > > in another place is not very helpful, so this plugs the virterror
> > > handling into the logging routine. mostly a bit of refactoring,
> > > and calling virLogMessage. Just that we pass an extra flag to
> > > virLogMessage stating it comes from the error handling level to avoid
> > > outputting the error twice on stderr in case where there is no
> > > output defined.
> > 
> > Yep, makes sense.
> > 
> > > @@ -392,6 +411,12 @@
> > >      }
> > >  
> > >      /*
> > > +     * Hook up the error or warning to the logging facility
> > > +     */
> > > +    virLogMessage(virErrorDomainName(domain), virErrorLevelPriority(level),
> > > +                  1, "%s", str);
> > > +
> > > +    /*
> > >       * Save the information about the error
> > >       */
> > >      virResetError(to);
> > 
> > Hmm, but later on down the file we still call virDefaultErrorFunc()
> > which would log the message a second time surely ?
> 
>   To the application using libvirt, but not to the logs file. The
> potential annoyance is when you get both going to stderr for example
> if using virsh.

Oh  yes, of course. In any case the output would only be duplicated if
the user had turned on logging to stderr, and the app had not already
disabled the default error printing function. So no real problem.

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