[libvirt] logging: how about adding a ProcessName field in logging file?

Suppose there are 3 or more clients of libvirt: 1)nova 2)bash virsh commands 3)user customized ELF 4)etc.... The env LIBVIRT_DEBUG and LIBVIRT_LOG_OUTPUTS affects all of these clients, thus, they will all accumulate the logs into *ONE* file set by LIBVIRT_LOG_OUTPUTS. eg: [2015-03-07 00:33:30]: 103674: info : virDomainShutdown:3242 : enter virDomainShutdown domainname=VMName [2015-03-07 00:33:41]: 103674: info : virDomainShutdown:3253 : domain VMName shutted down [2015-03-13 00:53:44]: 5073: info : libvirt version: 1.2.7 [2015-03-13 00:53:44]: 5034: info : libvirt version: 1.2.7 [2015-03-13 00:53:44]: 5073: error : virNetSocketReadWire:1475 : End of file while reading data: Input/output error note: 103674: bash virsh command 5037: nova if we don't know that 103674 is just a virsh command, and suspect that it's nova, time would be wasted to find out who's the criminal. The improved log would be: [2015-03-07 00:33:30]: virsh: 103674: info : virDomainShutdown:3242 : enter virDomainShutdown domainname=VMName [2015-03-07 00:33:41]: virsh: 103674: info : virDomainShutdown:3253 : domain VMName shutted down [2015-03-13 00:53:44]: nova: 5073: info : libvirt version: 1.2.7 [2015-03-13 00:53:44]: myProc1: 5034: info : libvirt version: 1.2.7 [2015-03-13 00:53:44]: nova: error : virNetSocketReadWire:1475 : End of file while reading data: Input/output error So, here's the qeustion: Is it neccssary to add a ProcessName field in the logging file? if so, I'd like to apply a patch for this. thank you in advance.

On Fri, Mar 13, 2015 at 05:08:54PM +0800, zhang bo wrote:
Suppose there are 3 or more clients of libvirt: 1)nova 2)bash virsh commands 3)user customized ELF 4)etc....
The env LIBVIRT_DEBUG and LIBVIRT_LOG_OUTPUTS affects all of these clients, thus, they will all accumulate the logs into *ONE* file set by LIBVIRT_LOG_OUTPUTS.
There is no attempt to make sure that separate clients logging to the same file will atomically write log lines. You could get half a line of text from one client, then half a line of text from a second client, then the rest of the line from the first client all mangled up. You simply shouldn't give each client process the same logging output file. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 2015/3/13 17:29, Daniel P. Berrange wrote:
On Fri, Mar 13, 2015 at 05:08:54PM +0800, zhang bo wrote:
Suppose there are 3 or more clients of libvirt: 1)nova 2)bash virsh commands 3)user customized ELF 4)etc....
The env LIBVIRT_DEBUG and LIBVIRT_LOG_OUTPUTS affects all of these clients, thus, they will all accumulate the logs into *ONE* file set by LIBVIRT_LOG_OUTPUTS.
There is no attempt to make sure that separate clients logging to the same file will atomically write log lines. You could get half a line of text from one client, then half a line of text from a second client, then the rest of the line from the first client all mangled up. You simply shouldn't give each client process the same logging output file.
Regards, Daniel
Got it, thank you for your immediate reply :)
participants (2)
-
Daniel P. Berrange
-
zhang bo