Changes in v2 based on danpb feedback:
- make libvirtd.log the default instead of syslog
- do not open the libvirtd.log directly
- create a new API to dump debug buffer to file output
- use that new API now in the fatal signal handler
This patch set main goal is to allow dumping
of full debug informations for operations occuring
in libvirt daemon before a crash.
The principle is to save all logs to a round-robbin memory
buffer (which we already do, except we never use that
buffer), save the general daemon logs to a libvirtd.log
file and upon reception of a fatal signal, save the memory
buffer directly to the log file(s) or stderr.
There is quite a few remarks about this, we already have
that buffer but we don't log everything in, only what's
output, that's what patch 1 changes, then we need to
provide a function to dump it in emergency from signal
handler so this also adds a new API for it.
We also need to be cautious about what
system call we operate from the signal handler, but
basically we should limit ourselves here to write and
sigaction which are safe there dixit POSIX.
Something like killall -USR2 libvirtd allows to see the
kind of output one get, an idle libvirtd is quiet, but
handle/timer/fdpolls tend to be very verbose,
Maybe now that this part is well debugged some of those
could be suppressed or commented off.
Also the buffer is a statically allocated 64KB, this
should be made more flexible based on a configuration
entry but it's left for another patch.
Daniel