[Libvir] [PATCH] output virsh log to file

Nobuhiro Itou fj0873gn at aa.jp.fujitsu.com
Thu Jun 7 06:22:38 UTC 2007

Hi, Daniel

Thank you for committing virsh log patch.

>   Way simpler, that works, I just fixed a couple of things:
>     - removed defines for buffer size which were not needed anymore

Oops, sorry. I had forgotten to erase it.

>     - if no log file name was given do not try to open it

Okey. I agree.

> 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.

Yes. I also had recognized this problem.
I think so the libvirt error is the most useful, too.
I try to think about measures.

> 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.

Hum, I understood that you said.
But, I think that virsh must not overwrite the logfile without 
user's permission, because virsh doesn't know what the file user 
specified contains.
If it is append mode, the old contents of a file do not disappear.
User can delete it later if needless, and can keep it if need.

Nobuhiro Itou.

More information about the libvir-list mailing list