From 08ddbe61f68856bfb75f3def0080928e5e3c1599 Mon Sep 17 00:00:00 2001
From: Daniel Veillard
The logging functionalities in libvirt are based on 3 key concepts, similar to the one present in other generic logging facilities like log4j:
Note that the logging module saves all logs to a debug buffer + filled in a round-robin fashion as to keep a full log of the + recent logs including all debug. The debug buffer can be resized + or deactivated in the daemon using the log_buffer_size variable, + default is 64 kB. This can be used when debugging the library + (see the virLogBuffer variable content).
+ +The library configuration of logging is through 3 environment variables allowing to control the logging behaviour:
Similarly the daemon logging behaviour can be tuned using 3 config variables, stored in the configuration file:
When starting the libvirt daemon, any logging environment variable settings will override settings in the config file. Command line options take precedence over all. If no outputs are defined for libvirtd, it - defaults to logging to syslog when it is running as a daemon, or to + defaults to logging to /var/log/libvirt/libvirtd.log (before 0.9.0 + it was using syslog) when it is running as a daemon, or to stderr when it is running in the foreground.
Libvirtd does not reload its logging configuration when issued a SIGHUP.
If you want to reload the configuration, you must do a service
libvirtd restart
or manually stop and restart the daemon
yourself.
Starting from 0.9.0, the daemon can save all the content of the debug + buffer to the defined error channels (or /var/log/libvirt/libvirtd.log + by default) in case of crash, this can also be activated explicitly + for debugging purposes by sending the daemon a USR2 signal:
+killall -USR2 libvirtd+
The syntax for filters and outputs is the same for both types of variables.
The format for a filter is:
@@ -109,8 +151,11 @@Multiple output can be defined, they just need to be separated by
spaces, e.g.: "3:syslog:libvirtd 1:file:/tmp/libvirt.log"
will log all warnings and errors to syslog under the libvirtd ident
- but also log everything debugging and informations included in the
+ but also log all debug and information included in the
file /tmp/libvirt.log
For example setting up the following:
export LIBVIRT_DEBUG=1 export LIBVIRT_LOG_OUTPUTS="1:file:virsh.log"@@ -123,5 +168,16 @@ export LIBVIRT_LOG_OUTPUTS="1:file:virsh.log" message. This should be sufficient to at least get a precise idea of what is happening and where things are going wrong, allowing to then put the correct breakpoints when running under a debugger. +
To activate full debug of the libvirt entry points, utility + functions and the QEmu/KVM driver, set:
+log_filters=1:libvirt 1:util 1:qemu +log_output=1:file:/var/log/libvirt/libvirtd.log+
in libvirtd.conf and restart the daemon will allow to + gather a copious amount of debugging traces for the operations done + in those areas.
+On the other hand to deactivate the logbuffer in the daemon + for stable high load servers, set
+log_buffer_size=0+
in the libvirtd.conf.