[Libvir] [PATCH] output virsh log to file

Daniel Veillard veillard at redhat.com
Wed Jun 6 12:30:37 UTC 2007


On Wed, Jun 06, 2007 at 05:39:40PM +0900, Nobuhiro Itou wrote:
> >   I expect the use to be the following:
> >      - users uses virsh for virtualization operation
> >      - something suddenly does not work
> >      - then he re-runs the command with logging 
> >      - then he can analyze the log or transmit it to a sysadmin who
> >        can have a look
> > but I don't believe in reimplementing something like syslog within virsh to 
> > log all operations all the time, especially with a fixed size buffer. logs 
> > will be intermixed, hard to process, add a burden on the server, and makes
> > the code way more complex than it needs to be.
> > 
> >   Maybe I didn't understood how you expected logging to work, but apparently
> > we had different viewpoints, I would rather go for the simplest,
> 
> I agree.

  excellent !

> >   does that still work for your use case ?
> 
> Yes.
> How about this attached patch?

  Way simpler, that works, I just fixed a couple of things:
    - removed defines for buffer size which were not needed anymore
    - if no log file name was given do not try to open it

I commited this in CVS but I'm afraid there is something missing, look at the
following:

paphio:~/libvirt/src -> ./virsh --log logfile list
libvir: error : no support for hypervisor (null)
virsh: error: failed to connect to the hypervisor
paphio:~/libvirt/src -> cat logfile
[2007.06.06 14:26:30 virsh] ERROR failed to connect to the hypervisor
paphio:~/libvirt/src -> 

the machine is not running Xen so the error is normal, the trouble is that
the logfile only contains the virsh error not the libvirt one (which is the
one the most useful), this need debugging I guess.
Another question is that the log file is opened in append mode, while I guess
this kind of option usually rewrite the file from scratch, but this is an 
open question, I can see how both behaviour could be useful or annoying 
depending on the circumstances.

  thanks !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list