[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 14/28] Rename logging.{c,h} to virlog.{c,h}



From: "Daniel P. Berrange" <berrange redhat com>

---
 daemon/libvirtd-config.c                  |    2 +-
 daemon/libvirtd.h                         |    2 +-
 daemon/remote.c                           |    2 +-
 daemon/stream.c                           |    2 +-
 src/Makefile.am                           |    2 +-
 src/conf/domain_audit.c                   |    2 +-
 src/conf/domain_conf.c                    |    2 +-
 src/conf/domain_event.c                   |    2 +-
 src/conf/nwfilter_params.c                |    2 +-
 src/conf/secret_conf.c                    |    2 +-
 src/conf/snapshot_conf.c                  |    2 +-
 src/conf/virconsole.c                     |    2 +-
 src/cpu/cpu.c                             |    2 +-
 src/cpu/cpu_powerpc.c                     |    2 +-
 src/cpu/cpu_x86.c                         |    2 +-
 src/datatypes.c                           |    2 +-
 src/driver.c                              |    2 +-
 src/esx/esx_device_monitor.c              |    2 +-
 src/esx/esx_driver.c                      |    2 +-
 src/esx/esx_interface_driver.c            |    2 +-
 src/esx/esx_network_driver.c              |    2 +-
 src/esx/esx_nwfilter_driver.c             |    2 +-
 src/esx/esx_secret_driver.c               |    2 +-
 src/esx/esx_storage_backend_iscsi.c       |    2 +-
 src/esx/esx_storage_backend_vmfs.c        |    2 +-
 src/esx/esx_util.c                        |    2 +-
 src/esx/esx_vi.c                          |    2 +-
 src/esx/esx_vi_methods.c                  |    2 +-
 src/esx/esx_vi_types.c                    |    2 +-
 src/fdstream.c                            |    2 +-
 src/hyperv/hyperv_device_monitor.c        |    2 +-
 src/hyperv/hyperv_driver.c                |    2 +-
 src/hyperv/hyperv_interface_driver.c      |    2 +-
 src/hyperv/hyperv_network_driver.c        |    2 +-
 src/hyperv/hyperv_nwfilter_driver.c       |    2 +-
 src/hyperv/hyperv_secret_driver.c         |    2 +-
 src/hyperv/hyperv_storage_driver.c        |    2 +-
 src/hyperv/hyperv_util.c                  |    2 +-
 src/hyperv/hyperv_wmi.c                   |    2 +-
 src/interface/interface_backend_netcf.c   |    2 +-
 src/libvirt-qemu.c                        |    2 +-
 src/libvirt.c                             |    2 +-
 src/libxl/libxl_conf.c                    |    2 +-
 src/libxl/libxl_driver.c                  |    2 +-
 src/locking/domain_lock.c                 |    2 +-
 src/locking/lock_daemon.c                 |    2 +-
 src/locking/lock_daemon_config.c          |    2 +-
 src/locking/lock_daemon_dispatch.c        |    2 +-
 src/locking/lock_driver_lockd.c           |    2 +-
 src/locking/lock_driver_nop.c             |    2 +-
 src/locking/lock_driver_sanlock.c         |    2 +-
 src/locking/lock_manager.c                |    2 +-
 src/lxc/lxc_cgroup.c                      |    2 +-
 src/lxc/lxc_conf.c                        |    2 +-
 src/lxc/lxc_container.c                   |    2 +-
 src/lxc/lxc_controller.c                  |    2 +-
 src/lxc/lxc_domain.c                      |    2 +-
 src/lxc/lxc_driver.c                      |    2 +-
 src/lxc/lxc_fuse.c                        |    2 +-
 src/lxc/lxc_monitor.c                     |    2 +-
 src/lxc/lxc_process.c                     |    2 +-
 src/network/bridge_driver.c               |    2 +-
 src/node_device/node_device_driver.c      |    2 +-
 src/node_device/node_device_hal.c         |    2 +-
 src/node_device/node_device_linux_sysfs.c |    2 +-
 src/node_device/node_device_udev.c        |    2 +-
 src/nodeinfo.c                            |    2 +-
 src/nwfilter/nwfilter_dhcpsnoop.c         |    2 +-
 src/nwfilter/nwfilter_driver.c            |    2 +-
 src/nwfilter/nwfilter_ebiptables_driver.c |    2 +-
 src/nwfilter/nwfilter_gentech_driver.c    |    2 +-
 src/nwfilter/nwfilter_learnipaddr.c       |    2 +-
 src/openvz/openvz_driver.c                |    2 +-
 src/parallels/parallels_driver.c          |    2 +-
 src/phyp/phyp_driver.c                    |    2 +-
 src/qemu/qemu_agent.c                     |    2 +-
 src/qemu/qemu_bridge_filter.c             |    2 +-
 src/qemu/qemu_capabilities.c              |    2 +-
 src/qemu/qemu_cgroup.c                    |    2 +-
 src/qemu/qemu_command.c                   |    2 +-
 src/qemu/qemu_conf.c                      |    2 +-
 src/qemu/qemu_domain.c                    |    2 +-
 src/qemu/qemu_driver.c                    |    2 +-
 src/qemu/qemu_hostdev.c                   |    2 +-
 src/qemu/qemu_hotplug.c                   |    2 +-
 src/qemu/qemu_migration.c                 |    2 +-
 src/qemu/qemu_monitor.c                   |    2 +-
 src/qemu/qemu_monitor_json.c              |    2 +-
 src/qemu/qemu_monitor_text.c              |    2 +-
 src/qemu/qemu_process.c                   |    2 +-
 src/remote/remote_driver.c                |    2 +-
 src/rpc/virkeepalive.c                    |    2 +-
 src/rpc/virnetclient.c                    |    2 +-
 src/rpc/virnetclientprogram.c             |    2 +-
 src/rpc/virnetclientstream.c              |    2 +-
 src/rpc/virnetmessage.c                   |    2 +-
 src/rpc/virnetsaslcontext.c               |    2 +-
 src/rpc/virnetserver.c                    |    2 +-
 src/rpc/virnetserverclient.c              |    2 +-
 src/rpc/virnetservermdns.c                |    2 +-
 src/rpc/virnetserverprogram.c             |    2 +-
 src/rpc/virnetsocket.c                    |    2 +-
 src/rpc/virnetsshsession.c                |    2 +-
 src/rpc/virnettlscontext.c                |    2 +-
 src/secret/secret_driver.c                |    2 +-
 src/security/security_apparmor.c          |    2 +-
 src/security/security_dac.c               |    2 +-
 src/security/security_driver.c            |    2 +-
 src/security/security_manager.c           |    2 +-
 src/security/security_selinux.c           |    2 +-
 src/storage/storage_backend.c             |    2 +-
 src/storage/storage_backend_disk.c        |    2 +-
 src/storage/storage_backend_fs.c          |    2 +-
 src/storage/storage_backend_iscsi.c       |    2 +-
 src/storage/storage_backend_logical.c     |    2 +-
 src/storage/storage_backend_mpath.c       |    2 +-
 src/storage/storage_backend_rbd.c         |    2 +-
 src/storage/storage_backend_scsi.c        |    2 +-
 src/storage/storage_backend_sheepdog.c    |    2 +-
 src/storage/storage_driver.c              |    2 +-
 src/test/test_driver.c                    |    2 +-
 src/uml/uml_conf.c                        |    2 +-
 src/uml/uml_driver.c                      |    2 +-
 src/util/logging.c                        | 1590 -----------------------------
 src/util/logging.h                        |  191 ----
 src/util/memory.c                         |    2 +-
 src/util/pci.c                            |    2 +-
 src/util/storage_file.c                   |    2 +-
 src/util/sysinfo.c                        |    2 +-
 src/util/util.c                           |    2 +-
 src/util/uuid.c                           |    2 +-
 src/util/viraudit.c                       |    2 +-
 src/util/virauth.c                        |    2 +-
 src/util/virauthconfig.c                  |    2 +-
 src/util/vircgroup.c                      |    2 +-
 src/util/vircommand.c                     |    2 +-
 src/util/virconf.c                        |    2 +-
 src/util/virdbus.c                        |    2 +-
 src/util/virdnsmasq.c                     |    2 +-
 src/util/virebtables.c                    |    2 +-
 src/util/virevent.c                       |    2 +-
 src/util/vireventpoll.c                   |    2 +-
 src/util/virfile.c                        |    2 +-
 src/util/virhash.c                        |    2 +-
 src/util/virhooks.c                       |    2 +-
 src/util/viriptables.c                    |    2 +-
 src/util/virjson.c                        |    2 +-
 src/util/virkeyfile.c                     |    2 +-
 src/util/virlockspace.c                   |    2 +-
 src/util/virlog.c                         | 1590 +++++++++++++++++++++++++++++
 src/util/virlog.h                         |  191 ++++
 src/util/virnetdev.c                      |    2 +-
 src/util/virnetdevmacvlan.c               |    2 +-
 src/util/virnetdevtap.c                   |    2 +-
 src/util/virnetdevveth.c                  |    2 +-
 src/util/virnetdevvportprofile.c          |    2 +-
 src/util/virnetlink.c                     |    2 +-
 src/util/virnodesuspend.c                 |    2 +-
 src/util/virobject.c                      |    2 +-
 src/util/virpidfile.c                     |    2 +-
 src/util/virprocess.c                     |    2 +-
 src/util/virrandom.c                      |    2 +-
 src/util/virterror.c                      |    2 +-
 src/util/virusb.c                         |    2 +-
 src/vbox/vbox_MSCOMGlue.c                 |    2 +-
 src/vbox/vbox_XPCOMCGlue.c                |    2 +-
 src/vbox/vbox_driver.c                    |    2 +-
 src/vbox/vbox_tmpl.c                      |    2 +-
 src/vmx/vmx.c                             |    2 +-
 src/xen/xen_driver.c                      |    2 +-
 src/xen/xen_hypervisor.c                  |    2 +-
 src/xen/xen_inotify.c                     |    2 +-
 src/xen/xend_internal.c                   |    2 +-
 src/xen/xm_internal.c                     |    2 +-
 src/xen/xs_internal.c                     |    2 +-
 src/xenapi/xenapi_utils.c                 |    2 +-
 src/xenxs/xen_sxpr.c                      |    2 +-
 tests/eventtest.c                         |    2 +-
 tests/libvirtdconftest.c                  |    2 +-
 tests/qemumonitortestutils.c              |    2 +-
 tests/securityselinuxtest.c               |    2 +-
 tests/sockettest.c                        |    2 +-
 tests/testutils.c                         |    2 +-
 tests/virauthconfigtest.c                 |    2 +-
 tests/virdrivermoduletest.c               |    2 +-
 tests/virhashtest.c                       |    2 +-
 tests/virkeyfiletest.c                    |    2 +-
 tests/virlockspacetest.c                  |    2 +-
 tests/virnetmessagetest.c                 |    2 +-
 tests/virnetsockettest.c                  |    2 +-
 tests/virnettlscontexttest.c              |    2 +-
 tests/virstringtest.c                     |    2 +-
 tests/virtimetest.c                       |    2 +-
 tests/viruritest.c                        |    2 +-
 tools/console.c                           |    2 +-
 195 files changed, 1972 insertions(+), 1972 deletions(-)
 delete mode 100644 src/util/logging.c
 delete mode 100644 src/util/logging.h
 create mode 100644 src/util/virlog.c
 create mode 100644 src/util/virlog.h

diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c
index 0ca185c..f61f08d 100644
--- a/daemon/libvirtd-config.c
+++ b/daemon/libvirtd-config.c
@@ -27,7 +27,7 @@
 #include "virconf.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "rpc/virnetserver.h"
 #include "configmake.h"
 #include "remote/remote_protocol.h"
diff --git a/daemon/libvirtd.h b/daemon/libvirtd.h
index e389151..b04cc71 100644
--- a/daemon/libvirtd.h
+++ b/daemon/libvirtd.h
@@ -33,7 +33,7 @@
 # include <rpc/xdr.h>
 # include "remote_protocol.h"
 # include "qemu_protocol.h"
-# include "logging.h"
+# include "virlog.h"
 # include "threads.h"
 # if HAVE_SASL
 #  include "virnetsaslcontext.h"
diff --git a/daemon/remote.c b/daemon/remote.c
index 1746280..58ceb39 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -34,7 +34,7 @@
 #include "libvirt_internal.h"
 #include "datatypes.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 #include "stream.h"
 #include "uuid.h"
diff --git a/daemon/stream.c b/daemon/stream.c
index fa14eeb..d63e009 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -26,7 +26,7 @@
 #include "stream.h"
 #include "remote.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virnetserverclient.h"
 #include "virterror_internal.h"
 
diff --git a/src/Makefile.am b/src/Makefile.am
index dd49851..93da171 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,7 +53,6 @@ augeastest_DATA =
 # These files are not related to driver APIs. Simply generic
 # helper APIs for various purposes
 UTIL_SOURCES =							\
-		util/logging.c util/logging.h			\
 		util/memory.c util/memory.h			\
 		util/pci.c util/pci.h				\
 		util/processinfo.c util/processinfo.h		\
@@ -84,6 +83,7 @@ UTIL_SOURCES =							\
 		util/virnodesuspend.c util/virnodesuspend.h	\
 		util/viriptables.c util/viriptables.h		\
 		util/virjson.c util/virjson.h			\
+		util/virlog.c util/virlog.h			\
 		util/virobject.c util/virobject.h		\
 		util/virpidfile.c util/virpidfile.h		\
 		util/virprocess.c util/virprocess.h		\
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 939d213..5fca6a6 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -29,7 +29,7 @@
 #include "domain_audit.h"
 #include "viraudit.h"
 #include "uuid.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 
 /* Return nn:mm in hex for block and character devices, and NULL
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d1fadc3..c48adf5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -40,7 +40,7 @@
 #include "uuid.h"
 #include "util.h"
 #include "virbuffer.h"
-#include "logging.h"
+#include "virlog.h"
 #include "nwfilter_conf.h"
 #include "storage_file.h"
 #include "virfile.h"
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index cf37308..f1e247b 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -24,7 +24,7 @@
 #include <config.h>
 
 #include "domain_event.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "memory.h"
 #include "virterror_internal.h"
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index 7254519..f8cf980 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -30,7 +30,7 @@
 #include "datatypes.h"
 #include "nwfilter_params.h"
 #include "domain_conf.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_NWFILTER
 
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index ec67f57..24d7aa0 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -25,7 +25,7 @@
 #include "internal.h"
 #include "virbuffer.h"
 #include "datatypes.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "secret_conf.h"
 #include "virterror_internal.h"
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 38a3e2a..6361810 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -34,7 +34,7 @@
 #include "count-one-bits.h"
 #include "datatypes.h"
 #include "domain_conf.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "netdev_bandwidth_conf.h"
 #include "netdev_vport_profile_conf.h"
diff --git a/src/conf/virconsole.c b/src/conf/virconsole.c
index 143c1a6..92179cc 100644
--- a/src/conf/virconsole.c
+++ b/src/conf/virconsole.c
@@ -34,7 +34,7 @@
 #include "threads.h"
 #include "memory.h"
 #include "virpidfile.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "virfile.h"
 
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index 4263b88..17a06f3 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -23,7 +23,7 @@
 
 #include <config.h>
 
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "xml.h"
 #include "cpu.h"
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index 363d6c1..c59bd1b 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -26,7 +26,7 @@
 #include <config.h>
 #include <stdint.h>
 
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "util.h"
 #include "cpu.h"
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 563cd67..bea48a1 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -25,7 +25,7 @@
 
 #include <stdint.h>
 
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "util.h"
 #include "cpu.h"
diff --git a/src/datatypes.c b/src/datatypes.c
index c0ed3a2..73a2fd0 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -24,7 +24,7 @@
 
 #include "datatypes.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "uuid.h"
 #include "util.h"
diff --git a/src/driver.c b/src/driver.c
index 6d2feb9..4ef6fd2 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -26,7 +26,7 @@
 
 #include "driver.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 #include "configmake.h"
 
diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c
index c3f9339..0ad95f5 100644
--- a/src/esx/esx_device_monitor.c
+++ b/src/esx/esx_device_monitor.c
@@ -27,7 +27,7 @@
 #include "internal.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "esx_private.h"
 #include "esx_device_monitor.h"
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index a858298..a69d149 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -30,7 +30,7 @@
 #include "virauth.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "vmx.h"
 #include "virtypedparam.h"
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
index 35bc7fa..4760264 100644
--- a/src/esx/esx_interface_driver.c
+++ b/src/esx/esx_interface_driver.c
@@ -27,7 +27,7 @@
 #include "internal.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "interface_conf.h"
 #include "virsocketaddr.h"
diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index 6a87abd..3e25aa2 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -28,7 +28,7 @@
 #include "internal.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "network_conf.h"
 #include "esx_private.h"
diff --git a/src/esx/esx_nwfilter_driver.c b/src/esx/esx_nwfilter_driver.c
index 9780ca6..f5e710d 100644
--- a/src/esx/esx_nwfilter_driver.c
+++ b/src/esx/esx_nwfilter_driver.c
@@ -27,7 +27,7 @@
 #include "internal.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "esx_private.h"
 #include "esx_nwfilter_driver.h"
diff --git a/src/esx/esx_secret_driver.c b/src/esx/esx_secret_driver.c
index 55b2e9a..2a98644 100644
--- a/src/esx/esx_secret_driver.c
+++ b/src/esx/esx_secret_driver.c
@@ -26,7 +26,7 @@
 #include "internal.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "esx_private.h"
 #include "esx_secret_driver.h"
diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_backend_iscsi.c
index b6cde96..5d4eb3c 100644
--- a/src/esx/esx_storage_backend_iscsi.c
+++ b/src/esx/esx_storage_backend_iscsi.c
@@ -30,7 +30,7 @@
 #include "md5.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "storage_conf.h"
 #include "storage_file.h"
diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c
index 5ef2981..c8bba9e 100644
--- a/src/esx/esx_storage_backend_vmfs.c
+++ b/src/esx/esx_storage_backend_vmfs.c
@@ -33,7 +33,7 @@
 #include "md5.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "storage_conf.h"
 #include "storage_file.h"
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index b807607..6e27fe4 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -30,7 +30,7 @@
 #include "datatypes.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "vmx.h"
 #include "esx_private.h"
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index d645bfb..76192df 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -28,7 +28,7 @@
 
 #include "virbuffer.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 #include "uuid.h"
 #include "vmx.h"
diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c
index a3c3c8b..a3870ee 100644
--- a/src/esx/esx_vi_methods.c
+++ b/src/esx/esx_vi_methods.c
@@ -25,7 +25,7 @@
 
 #include "virbuffer.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "esx_vi_methods.h"
 #include "esx_util.h"
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index 1654e1b..d0a2c6c 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -30,7 +30,7 @@
 #include "virbuffer.h"
 #include "datatypes.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 #include "esx_vi.h"
 #include "esx_vi_types.h"
diff --git a/src/fdstream.c b/src/fdstream.c
index d1eb04c..fdbd7a2 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -35,7 +35,7 @@
 #include "fdstream.h"
 #include "virterror_internal.h"
 #include "datatypes.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "util.h"
 #include "virfile.h"
diff --git a/src/hyperv/hyperv_device_monitor.c b/src/hyperv/hyperv_device_monitor.c
index e183798..1fa98b2 100644
--- a/src/hyperv/hyperv_device_monitor.c
+++ b/src/hyperv/hyperv_device_monitor.c
@@ -28,7 +28,7 @@
 #include "datatypes.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "hyperv_device_monitor.h"
 
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 4aed41f..95b0cd9 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -29,7 +29,7 @@
 #include "virauth.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "hyperv_driver.h"
 #include "hyperv_interface_driver.h"
diff --git a/src/hyperv/hyperv_interface_driver.c b/src/hyperv/hyperv_interface_driver.c
index 9b1bb37..6a3c2cb 100644
--- a/src/hyperv/hyperv_interface_driver.c
+++ b/src/hyperv/hyperv_interface_driver.c
@@ -28,7 +28,7 @@
 #include "datatypes.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "hyperv_interface_driver.h"
 
diff --git a/src/hyperv/hyperv_network_driver.c b/src/hyperv/hyperv_network_driver.c
index 3a61fe6..2f9fcab 100644
--- a/src/hyperv/hyperv_network_driver.c
+++ b/src/hyperv/hyperv_network_driver.c
@@ -28,7 +28,7 @@
 #include "datatypes.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "hyperv_network_driver.h"
 
diff --git a/src/hyperv/hyperv_nwfilter_driver.c b/src/hyperv/hyperv_nwfilter_driver.c
index 9d54f82..c490522 100644
--- a/src/hyperv/hyperv_nwfilter_driver.c
+++ b/src/hyperv/hyperv_nwfilter_driver.c
@@ -28,7 +28,7 @@
 #include "datatypes.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "hyperv_nwfilter_driver.h"
 
diff --git a/src/hyperv/hyperv_secret_driver.c b/src/hyperv/hyperv_secret_driver.c
index 7ee8ce9..3d58b01 100644
--- a/src/hyperv/hyperv_secret_driver.c
+++ b/src/hyperv/hyperv_secret_driver.c
@@ -28,7 +28,7 @@
 #include "datatypes.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "hyperv_secret_driver.h"
 
diff --git a/src/hyperv/hyperv_storage_driver.c b/src/hyperv/hyperv_storage_driver.c
index 2e03162..7fbc14d 100644
--- a/src/hyperv/hyperv_storage_driver.c
+++ b/src/hyperv/hyperv_storage_driver.c
@@ -28,7 +28,7 @@
 #include "datatypes.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "hyperv_storage_driver.h"
 
diff --git a/src/hyperv/hyperv_util.c b/src/hyperv/hyperv_util.c
index 3050d61..1ef6dae 100644
--- a/src/hyperv/hyperv_util.c
+++ b/src/hyperv/hyperv_util.c
@@ -26,7 +26,7 @@
 #include "datatypes.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "hyperv_private.h"
 #include "hyperv_util.h"
diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index 0a6b107..069ebe6 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -27,7 +27,7 @@
 #include "internal.h"
 #include "virterror_internal.h"
 #include "datatypes.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "util.h"
 #include "uuid.h"
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index 226e020..1f42920 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -30,7 +30,7 @@
 #include "interface_driver.h"
 #include "interface_conf.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_INTERFACE
 
diff --git a/src/libvirt-qemu.c b/src/libvirt-qemu.c
index cc98bbb..8d53b5c 100644
--- a/src/libvirt-qemu.c
+++ b/src/libvirt-qemu.c
@@ -24,7 +24,7 @@
 #include <config.h>
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "libvirt/libvirt-qemu.h"
 
diff --git a/src/libvirt.c b/src/libvirt.c
index 8f7a869..d078304 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -46,7 +46,7 @@
 #endif
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "driver.h"
 
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 55d2ef4..460d15f 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -32,7 +32,7 @@
 #include <sys/utsname.h>
 
 #include "internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "datatypes.h"
 #include "virfile.h"
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 884fca8..ced7cfa 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -32,7 +32,7 @@
 #include <fcntl.h>
 
 #include "internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "virconf.h"
 #include "datatypes.h"
diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c
index 1e3da5f..00861cf 100644
--- a/src/locking/domain_lock.c
+++ b/src/locking/domain_lock.c
@@ -25,7 +25,7 @@
 #include "memory.h"
 #include "uuid.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_LOCKING
 
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index 08caa16..3c2a50c 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -38,7 +38,7 @@
 #include "virpidfile.h"
 #include "virprocess.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "virconf.h"
 #include "rpc/virnetserver.h"
diff --git a/src/locking/lock_daemon_config.c b/src/locking/lock_daemon_config.c
index c2d9a76..9557b8c 100644
--- a/src/locking/lock_daemon_config.c
+++ b/src/locking/lock_daemon_config.c
@@ -27,7 +27,7 @@
 #include "virconf.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "rpc/virnetserver.h"
 #include "configmake.h"
 
diff --git a/src/locking/lock_daemon_dispatch.c b/src/locking/lock_daemon_dispatch.c
index bb4dcfa..78c9726 100644
--- a/src/locking/lock_daemon_dispatch.c
+++ b/src/locking/lock_daemon_dispatch.c
@@ -25,7 +25,7 @@
 #include "rpc/virnetserver.h"
 #include "rpc/virnetserverclient.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include "lock_daemon.h"
 #include "lock_protocol.h"
diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index c88c5af..d5d721d 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -24,7 +24,7 @@
 #include "lock_driver.h"
 #include "virconf.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "util.h"
 #include "virfile.h"
diff --git a/src/locking/lock_driver_nop.c b/src/locking/lock_driver_nop.c
index c9ab806..745a0bf 100644
--- a/src/locking/lock_driver_nop.c
+++ b/src/locking/lock_driver_nop.c
@@ -23,7 +23,7 @@
 
 #include "lock_driver_nop.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 
 
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 2eadc07..1e8df26 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -37,7 +37,7 @@
 
 #include "dirname.h"
 #include "lock_driver.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "memory.h"
 #include "util.h"
diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c
index e6d9308..f038d4e 100644
--- a/src/locking/lock_manager.c
+++ b/src/locking/lock_manager.c
@@ -24,7 +24,7 @@
 #include "lock_manager.h"
 #include "lock_driver_nop.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 #include "memory.h"
 #include "uuid.h"
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index e354d6c..b8c4308 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -25,7 +25,7 @@
 #include "lxc_container.h"
 #include "virfile.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "vircgroup.h"
 
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index 77667bd..ca36965 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -33,7 +33,7 @@
 #include "virterror_internal.h"
 #include "virconf.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "configmake.h"
 #include "lxc_container.h"
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 33ebf1f..4aae28e 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -54,7 +54,7 @@
 #endif
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "lxc_container.h"
 #include "util.h"
 #include "memory.h"
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index c9cac5d..78f10ab 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -53,7 +53,7 @@
 #endif
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 
 #include "lxc_conf.h"
diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c
index bd80d9f..77a64dd 100644
--- a/src/lxc/lxc_domain.c
+++ b/src/lxc/lxc_domain.c
@@ -24,7 +24,7 @@
 #include "lxc_domain.h"
 
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 9c35406..0ab2cb9 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -36,7 +36,7 @@
 #include <wait.h>
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "lxc_conf.h"
 #include "lxc_container.h"
diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
index 4e7df55..485456e 100644
--- a/src/lxc/lxc_fuse.c
+++ b/src/lxc/lxc_fuse.c
@@ -32,7 +32,7 @@
 #include "lxc_fuse.h"
 #include "lxc_cgroup.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "virbuffer.h"
 
diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c
index 4d177c9..9eb587d 100644
--- a/src/lxc/lxc_monitor.c
+++ b/src/lxc/lxc_monitor.c
@@ -28,7 +28,7 @@
 #include "memory.h"
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "threads.h"
 #include "rpc/virnetclient.h"
 
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index d59bd2e..02ed226 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -41,7 +41,7 @@
 #include "memory.h"
 #include "domain_audit.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "vircommand.h"
 #include "virhooks.h"
 
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index bc37bde..2a59b84 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -57,7 +57,7 @@
 #include "memory.h"
 #include "uuid.h"
 #include "viriptables.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virdnsmasq.h"
 #include "configmake.h"
 #include "virnetdev.h"
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 4d3e01b..48360e3 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -33,7 +33,7 @@
 #include "virterror_internal.h"
 #include "datatypes.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "node_device_conf.h"
 #include "node_device_hal.h"
 #include "node_device_driver.h"
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 080aaed..59ba5c3 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -36,7 +36,7 @@
 #include "memory.h"
 #include "uuid.h"
 #include "pci.h"
-#include "logging.h"
+#include "virlog.h"
 #include "node_device_driver.h"
 #include "virdbus.h"
 
diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
index 3048e33..fbe0da5 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -30,7 +30,7 @@
 #include "node_device_hal.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_NODEDEV
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index b3499fb..fef00ad 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -32,7 +32,7 @@
 #include "node_device_driver.h"
 #include "driver.h"
 #include "datatypes.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "uuid.h"
 #include "util.h"
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 096000b..0019c2b 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -43,7 +43,7 @@
 #include "nodeinfo.h"
 #include "physmem.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "count-one-bits.h"
 #include "intprops.h"
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index e4c895f..68aa233 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -55,7 +55,7 @@
 #include <net/if.h>
 
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "virterror_internal.h"
 #include "conf/domain_conf.h"
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 3aa026a..7fde656 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -28,7 +28,7 @@
 #include <config.h>
 
 #include "virdbus.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include "internal.h"
 
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 6966acf..23a43d2 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -32,7 +32,7 @@
 
 #include "virbuffer.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "domain_conf.h"
 #include "nwfilter_conf.h"
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 572acf4..6be4a93 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -27,7 +27,7 @@
 #include "internal.h"
 
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "domain_conf.h"
 #include "virterror_internal.h"
 #include "nwfilter_gentech_driver.h"
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 361bdce..110eae8 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -43,7 +43,7 @@
 #include "intprops.h"
 #include "virbuffer.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "virnetdev.h"
 #include "virterror_internal.h"
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 75d52e2..101fa32 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -56,7 +56,7 @@
 #include "memory.h"
 #include "virfile.h"
 #include "virtypedparam.h"
-#include "logging.h"
+#include "virlog.h"
 #include "vircommand.h"
 #include "viruri.h"
 #include "stats_linux.h"
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 648cb48..4e6f903 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -45,7 +45,7 @@
 #include "virterror_internal.h"
 #include "memory.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 #include "vircommand.h"
 #include "configmake.h"
 #include "storage_file.h"
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index e54f0f3..0ac2771 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -49,7 +49,7 @@
 #include "datatypes.h"
 #include "virbuffer.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "driver.h"
 #include "libvirt/libvirt.h"
 #include "virterror_internal.h"
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 6727294..421e43f 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -35,7 +35,7 @@
 #include "qemu_agent.h"
 #include "qemu_command.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "virjson.h"
 #include "virfile.h"
diff --git a/src/qemu/qemu_bridge_filter.c b/src/qemu/qemu_bridge_filter.c
index a6d0d4f..08a9f1a 100644
--- a/src/qemu/qemu_bridge_filter.c
+++ b/src/qemu/qemu_bridge_filter.c
@@ -27,7 +27,7 @@
 #include "qemu_driver.h"
 #include "util.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include "qemu_bridge_filter.h"
 
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f68e081..5853180 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -25,7 +25,7 @@
 
 #include "qemu_capabilities.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "util.h"
 #include "virfile.h"
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 6c6607d..8d9ccf9 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -27,7 +27,7 @@
 #include "qemu_domain.h"
 #include "qemu_process.h"
 #include "vircgroup.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "virterror_internal.h"
 #include "util.h"
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 04a9512..8a35982 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -29,7 +29,7 @@
 #include "qemu_bridge_filter.h"
 #include "cpu/cpu.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "util.h"
 #include "virfile.h"
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 7c8d826..598fad7 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -48,7 +48,7 @@
 #include "datatypes.h"
 #include "xml.h"
 #include "nodeinfo.h"
-#include "logging.h"
+#include "virlog.h"
 #include "cpu/cpu.h"
 #include "domain_nwfilter.h"
 #include "virfile.h"
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8d8cf02..e6eaa58 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -28,7 +28,7 @@
 #include "qemu_capabilities.h"
 #include "qemu_migration.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "c-ctype.h"
 #include "cpu/cpu.h"
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 79f42fb..25e5738 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -60,7 +60,7 @@
 #include "qemu_migration.h"
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "virbuffer.h"
 #include "util.h"
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index aa000d1..3854520 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -24,7 +24,7 @@
 #include <config.h>
 
 #include "qemu_hostdev.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "memory.h"
 #include "pci.h"
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index e9a5e35..7edd125 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -32,7 +32,7 @@
 #include "qemu_hostdev.h"
 #include "domain_audit.h"
 #include "domain_nwfilter.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "virterror_internal.h"
 #include "memory.h"
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 468a92f..cabbe1a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -36,7 +36,7 @@
 #include "qemu_cgroup.h"
 
 #include "domain_audit.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "memory.h"
 #include "util.h"
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 131e8df..920453d 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -33,7 +33,7 @@
 #include "qemu_monitor_json.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "virprocess.h"
 #include "virobject.h"
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 6181668..e14134b 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -36,7 +36,7 @@
 #include "qemu_command.h"
 #include "qemu_capabilities.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "driver.h"
 #include "datatypes.h"
 #include "virterror_internal.h"
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index a12adb6..28690b1 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -35,7 +35,7 @@
 #include "c-ctype.h"
 #include "c-strcasestr.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "driver.h"
 #include "datatypes.h"
 #include "virterror_internal.h"
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e528d78..a77b248 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -51,7 +51,7 @@
 #endif
 
 #include "datatypes.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "memory.h"
 #include "virhooks.h"
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 8b77e7d..1e9151a 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -30,7 +30,7 @@
 #include "virnetclientprogram.h"
 #include "virnetclientstream.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "domain_event.h"
 #include "driver.h"
diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c
index 309f22f..8fc1cba 100644
--- a/src/rpc/virkeepalive.c
+++ b/src/rpc/virkeepalive.c
@@ -25,7 +25,7 @@
 #include "memory.h"
 #include "threads.h"
 #include "virfile.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 #include "virterror_internal.h"
 #include "virnetsocket.h"
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index bf2547c..7370ae0 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -33,7 +33,7 @@
 #include "memory.h"
 #include "threads.h"
 #include "virfile.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 #include "virterror_internal.h"
 
diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c
index 1f08640..dec3943 100644
--- a/src/rpc/virnetclientprogram.c
+++ b/src/rpc/virnetclientprogram.c
@@ -30,7 +30,7 @@
 
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 #include "virfile.h"
 #include "threads.h"
diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
index 0e7e38e..26dc292 100644
--- a/src/rpc/virnetclientstream.c
+++ b/src/rpc/virnetclientstream.c
@@ -26,7 +26,7 @@
 #include "virnetclient.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "threads.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
diff --git a/src/rpc/virnetmessage.c b/src/rpc/virnetmessage.c
index cf76e21..16d8e61 100644
--- a/src/rpc/virnetmessage.c
+++ b/src/rpc/virnetmessage.c
@@ -26,7 +26,7 @@
 #include "virnetmessage.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "util.h"
 
diff --git a/src/rpc/virnetsaslcontext.c b/src/rpc/virnetsaslcontext.c
index b6b68d5..e880127 100644
--- a/src/rpc/virnetsaslcontext.c
+++ b/src/rpc/virnetsaslcontext.c
@@ -28,7 +28,7 @@
 #include "virterror_internal.h"
 #include "memory.h"
 #include "threads.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index f686a8f..6d3532a 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -28,7 +28,7 @@
 #include <fcntl.h>
 
 #include "virnetserver.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "virterror_internal.h"
 #include "threads.h"
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index ed26719..9642ea5 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -29,7 +29,7 @@
 
 #include "virnetserverclient.h"
 
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "memory.h"
 #include "threads.h"
diff --git a/src/rpc/virnetservermdns.c b/src/rpc/virnetservermdns.c
index 166b4eb..c17b65d 100644
--- a/src/rpc/virnetservermdns.c
+++ b/src/rpc/virnetservermdns.c
@@ -44,7 +44,7 @@
 #include "vireventpoll.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index e4aa2da..5b96c34 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -28,7 +28,7 @@
 
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "threads.h"
 
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 5a2eab3..aa8f4b9 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -44,7 +44,7 @@
 #include "util.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "threads.h"
 #include "virprocess.h"
diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c
index d890569..734acaa 100644
--- a/src/rpc/virnetsshsession.c
+++ b/src/rpc/virnetsshsession.c
@@ -28,7 +28,7 @@
 #include "internal.h"
 #include "virbuffer.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "configmake.h"
 #include "threads.h"
 #include "util.h"
diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index 1d32327..2931003 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -33,7 +33,7 @@
 #include "memory.h"
 #include "virterror_internal.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 #include "threads.h"
 #include "configmake.h"
 
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index d9ba42b..4159358 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -32,7 +32,7 @@
 #include "base64.h"
 #include "datatypes.h"
 #include "driver.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "secret_conf.h"
 #include "secret_driver.h"
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 034eb04..f2aebc8 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -48,7 +48,7 @@
 #include "virfile.h"
 #include "configmake.h"
 #include "vircommand.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECURITY
 #define SECURITY_APPARMOR_VOID_DOI      "0"
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 9f5d39d..9ff2665 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -27,7 +27,7 @@
 #include "virterror_internal.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "pci.h"
 #include "virusb.h"
 #include "storage_file.h"
diff --git a/src/security/security_driver.c b/src/security/security_driver.c
index c7ff8a5..82d3ca9 100644
--- a/src/security/security_driver.c
+++ b/src/security/security_driver.c
@@ -24,7 +24,7 @@
 #include <string.h>
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include "security_driver.h"
 #ifdef WITH_SECDRIVER_SELINUX
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 690e4da..67c8858 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -28,7 +28,7 @@
 #include "security_dac.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECURITY
 
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index eb4f253..2a19781 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -36,7 +36,7 @@
 #include "virterror_internal.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "pci.h"
 #include "virusb.h"
 #include "storage_file.h"
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 083028d..899caeb 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -54,7 +54,7 @@
 #include "uuid.h"
 #include "storage_file.h"
 #include "storage_backend.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "stat-time.h"
 
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index c6aa407..7e1d3ec 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -27,7 +27,7 @@
 #include <stdio.h>
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "storage_backend_disk.h"
 #include "util.h"
 #include "memory.h"
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index cdf93af..78b50f0 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -49,7 +49,7 @@
 #include "memory.h"
 #include "xml.h"
 #include "virfile.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index c468b1b..46659af 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -39,7 +39,7 @@
 #include "storage_backend_iscsi.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "vircommand.h"
 #include "virrandom.h"
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 53e6c61..f28c663 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -36,7 +36,7 @@
 #include "storage_conf.h"
 #include "vircommand.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index efcfb28..1ca120f 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -33,7 +33,7 @@
 #include "storage_conf.h"
 #include "storage_backend.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index bc61cf7..4e58911 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -27,7 +27,7 @@
 #include "storage_conf.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "base64.h"
 #include "uuid.h"
 #include "rados/librados.h"
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 6515e57..32713be 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -31,7 +31,7 @@
 #include "virterror_internal.h"
 #include "storage_backend_scsi.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "vircommand.h"
 
diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index ecca7a8..05deeeb 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -32,7 +32,7 @@
 #include "vircommand.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index c567fff..6076f6c 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -44,7 +44,7 @@
 #include "storage_conf.h"
 #include "memory.h"
 #include "storage_backend.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "fdstream.h"
 #include "configmake.h"
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 8e57370..dbaf14e 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -48,7 +48,7 @@
 #include "node_device_conf.h"
 #include "xml.h"
 #include "threads.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "virtypedparam.h"
 #include "virrandom.h"
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 51e5a7a..35b54c2 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -42,7 +42,7 @@
 #include "util.h"
 #include "memory.h"
 #include "nodeinfo.h"
-#include "logging.h"
+#include "virlog.h"
 #include "domain_nwfilter.h"
 #include "virfile.h"
 #include "vircommand.h"
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 8dece66..90c9b66 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -56,7 +56,7 @@
 #include "domain_conf.h"
 #include "domain_audit.h"
 #include "datatypes.h"
-#include "logging.h"
+#include "virlog.h"
 #include "domain_nwfilter.h"
 #include "virfile.h"
 #include "fdstream.h"
diff --git a/src/util/logging.c b/src/util/logging.c
deleted file mode 100644
index 0df3549..0000000
--- a/src/util/logging.c
+++ /dev/null
@@ -1,1590 +0,0 @@
-/*
- * logging.c: internal logging and debugging
- *
- * Copyright (C) 2008, 2010-2012 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <signal.h>
-#include <execinfo.h>
-#if HAVE_SYSLOG_H
-# include <syslog.h>
-#endif
-#include <sys/socket.h>
-#if HAVE_SYS_UN_H
-# include <sys/un.h>
-#endif
-
-#include "virterror_internal.h"
-#include "logging.h"
-#include "memory.h"
-#include "util.h"
-#include "virbuffer.h"
-#include "threads.h"
-#include "virfile.h"
-#include "virtime.h"
-#include "intprops.h"
-
-/* Journald output is only supported on Linux new enough to expose
- * htole64.  */
-#if HAVE_SYSLOG_H && defined(__linux__) && HAVE_DECL_HTOLE64
-# define USE_JOURNALD 1
-#endif
-
-#define VIR_FROM_THIS VIR_FROM_NONE
-
-VIR_ENUM_DECL(virLogSource)
-VIR_ENUM_IMPL(virLogSource, VIR_LOG_FROM_LAST,
-              "file",
-              "error",
-              "audit",
-              "trace",
-              "library");
-
-/*
- * A logging buffer to keep some history over logs
- */
-
-static int virLogSize = 64 * 1024;
-static char *virLogBuffer = NULL;
-static int virLogLen = 0;
-static int virLogStart = 0;
-static int virLogEnd = 0;
-
-/*
- * Filters are used to refine the rules on what to keep or drop
- * based on a matching pattern (currently a substring)
- */
-struct _virLogFilter {
-    const char *match;
-    virLogPriority priority;
-    unsigned int flags;
-};
-typedef struct _virLogFilter virLogFilter;
-typedef virLogFilter *virLogFilterPtr;
-
-static virLogFilterPtr virLogFilters = NULL;
-static int virLogNbFilters = 0;
-
-/*
- * Outputs are used to emit the messages retained
- * after filtering, multiple output can be used simultaneously
- */
-struct _virLogOutput {
-    bool logVersion;
-    void *data;
-    virLogOutputFunc f;
-    virLogCloseFunc c;
-    virLogPriority priority;
-    virLogDestination dest;
-    const char *name;
-};
-typedef struct _virLogOutput virLogOutput;
-typedef virLogOutput *virLogOutputPtr;
-
-static virLogOutputPtr virLogOutputs = NULL;
-static int virLogNbOutputs = 0;
-
-/*
- * Default priorities
- */
-static virLogPriority virLogDefaultPriority = VIR_LOG_DEFAULT;
-
-static int virLogResetFilters(void);
-static int virLogResetOutputs(void);
-static void virLogOutputToFd(virLogSource src,
-                             virLogPriority priority,
-                             const char *filename,
-                             int linenr,
-                             const char *funcname,
-                             const char *timestamp,
-                             virLogMetadataPtr metadata,
-                             unsigned int flags,
-                             const char *rawstr,
-                             const char *str,
-                             void *data);
-
-/*
- * Logs accesses must be serialized though a mutex
- */
-virMutex virLogMutex;
-
-void
-virLogLock(void)
-{
-    virMutexLock(&virLogMutex);
-}
-
-
-void
-virLogUnlock(void)
-{
-    virMutexUnlock(&virLogMutex);
-}
-
-
-static const char *
-virLogOutputString(virLogDestination ldest)
-{
-    switch (ldest) {
-    case VIR_LOG_TO_STDERR:
-        return "stderr";
-    case VIR_LOG_TO_SYSLOG:
-        return "syslog";
-    case VIR_LOG_TO_FILE:
-        return "file";
-    case VIR_LOG_TO_JOURNALD:
-        return "journald";
-    }
-    return "unknown";
-}
-
-
-static const char *
-virLogPriorityString(virLogPriority lvl)
-{
-    switch (lvl) {
-    case VIR_LOG_DEBUG:
-        return "debug";
-    case VIR_LOG_INFO:
-        return "info";
-    case VIR_LOG_WARN:
-        return "warning";
-    case VIR_LOG_ERROR:
-        return "error";
-    }
-    return "unknown";
-}
-
-
-static int
-virLogOnceInit(void)
-{
-    const char *pbm = NULL;
-
-    if (virMutexInit(&virLogMutex) < 0)
-        return -1;
-
-    virLogLock();
-    if (VIR_ALLOC_N(virLogBuffer, virLogSize + 1) < 0) {
-        /*
-         * The debug buffer is not a critical component, allow startup
-         * even in case of failure to allocate it in case of a
-         * configuration mistake.
-         */
-        virLogSize = 64 * 1024;
-        if (VIR_ALLOC_N(virLogBuffer, virLogSize + 1) < 0) {
-            pbm = "Failed to allocate debug buffer: deactivating debug log\n";
-            virLogSize = 0;
-        } else {
-            pbm = "Failed to allocate debug buffer: reduced to 64 kB\n";
-        }
-    }
-    virLogLen = 0;
-    virLogStart = 0;
-    virLogEnd = 0;
-    virLogDefaultPriority = VIR_LOG_DEFAULT;
-    virLogUnlock();
-    if (pbm)
-        VIR_WARN("%s", pbm);
-    return 0;
-}
-
-VIR_ONCE_GLOBAL_INIT(virLog)
-
-
-/**
- * virLogSetBufferSize:
- * @size: size of the buffer in kilobytes or <= 0 to deactivate
- *
- * Dynamically set the size or deactivate the logging buffer used to keep
- * a trace of all recent debug output. Note that the content of the buffer
- * is lost if it gets reallocated.
- *
- * Return -1 in case of failure or 0 in case of success
- */
-int
-virLogSetBufferSize(int size)
-{
-    int ret = 0;
-    int oldsize;
-    char *oldLogBuffer;
-    const char *pbm = NULL;
-
-    if (size < 0)
-        size = 0;
-
-    if (virLogInitialize() < 0)
-        return -1;
-
-    if (size * 1024 == virLogSize)
-        return ret;
-
-    virLogLock();
-
-    oldsize = virLogSize;
-    oldLogBuffer = virLogBuffer;
-
-    if (INT_MAX / 1024 <= size) {
-        pbm = "Requested log size of %d kB too large\n";
-        ret = -1;
-        goto error;
-    }
-
-    virLogSize = size * 1024;
-    if (VIR_ALLOC_N(virLogBuffer, virLogSize + 1) < 0) {
-        pbm = "Failed to allocate debug buffer of %d kB\n";
-        virLogBuffer = oldLogBuffer;
-        virLogSize = oldsize;
-        ret = -1;
-        goto error;
-    }
-    VIR_FREE(oldLogBuffer);
-    virLogLen = 0;
-    virLogStart = 0;
-    virLogEnd = 0;
-
-error:
-    virLogUnlock();
-    if (pbm)
-        VIR_ERROR(pbm, size);
-    return ret;
-}
-
-
-/**
- * virLogReset:
- *
- * Reset the logging module to its default initial state
- *
- * Returns 0 if successful, and -1 in case or error
- */
-int
-virLogReset(void)
-{
-    if (virLogInitialize() < 0)
-        return -1;
-
-    virLogLock();
-    virLogResetFilters();
-    virLogResetOutputs();
-    virLogLen = 0;
-    virLogStart = 0;
-    virLogEnd = 0;
-    virLogDefaultPriority = VIR_LOG_DEFAULT;
-    virLogUnlock();
-    return 0;
-}
-
-
-/*
- * Store a string in the ring buffer
- */
-static void
-virLogStr(const char *str)
-{
-    int tmp;
-    int len;
-
-    if ((str == NULL) || (virLogBuffer == NULL) || (virLogSize <= 0))
-        return;
-    len = strlen(str);
-    if (len >= virLogSize)
-        return;
-
-    /*
-     * copy the data and reset the end, we cycle over the end of the buffer
-     */
-    if (virLogEnd + len >= virLogSize) {
-        tmp = virLogSize - virLogEnd;
-        memcpy(&virLogBuffer[virLogEnd], str, tmp);
-        memcpy(&virLogBuffer[0], &str[tmp], len - tmp);
-        virLogEnd = len - tmp;
-    } else {
-        memcpy(&virLogBuffer[virLogEnd], str, len);
-        virLogEnd += len;
-    }
-    virLogBuffer[virLogEnd] = 0;
-    /*
-     * Update the log length, and if full move the start index
-     */
-    virLogLen += len;
-    if (virLogLen > virLogSize) {
-        tmp = virLogLen - virLogSize;
-        virLogLen = virLogSize;
-        virLogStart += tmp;
-        if (virLogStart >= virLogSize)
-            virLogStart -= virLogSize;
-    }
-}
-
-
-static void
-virLogDumpAllFD(const char *msg, int len)
-{
-    int i, found = 0;
-
-    if (len <= 0)
-        len = strlen(msg);
-
-    for (i = 0; i < virLogNbOutputs;i++) {
-        if (virLogOutputs[i].f == virLogOutputToFd) {
-            int fd = (intptr_t) virLogOutputs[i].data;
-
-            if (fd >= 0) {
-                ignore_value(safewrite(fd, msg, len));
-                found = 1;
-            }
-        }
-    }
-    if (!found)
-        ignore_value(safewrite(STDERR_FILENO, msg, len));
-}
-
-
-/**
- * virLogEmergencyDumpAll:
- * @signum: the signal number
- *
- * Emergency function called, possibly from a signal handler.
- * It need to output the debug ring buffer through the log
- * output which are safe to use from a signal handler.
- * In case none is found it is emitted to standard error.
- */
-void
-virLogEmergencyDumpAll(int signum)
-{
-    int len;
-    int oldLogStart, oldLogLen;
-
-    switch (signum) {
-#ifdef SIGFPE
-        case SIGFPE:
-            virLogDumpAllFD("Caught signal Floating-point exception", -1);
-            break;
-#endif
-#ifdef SIGSEGV
-        case SIGSEGV:
-            virLogDumpAllFD("Caught Segmentation violation", -1);
-            break;
-#endif
-#ifdef SIGILL
-        case SIGILL:
-            virLogDumpAllFD("Caught illegal instruction", -1);
-            break;
-#endif
-#ifdef SIGABRT
-        case SIGABRT:
-            virLogDumpAllFD("Caught abort signal", -1);
-            break;
-#endif
-#ifdef SIGBUS
-        case SIGBUS:
-            virLogDumpAllFD("Caught bus error", -1);
-            break;
-#endif
-#ifdef SIGUSR2
-        case SIGUSR2:
-            virLogDumpAllFD("Caught User-defined signal 2", -1);
-            break;
-#endif
-        default:
-            virLogDumpAllFD("Caught unexpected signal", -1);
-            break;
-    }
-    if ((virLogBuffer == NULL) || (virLogSize <= 0)) {
-        virLogDumpAllFD(" internal log buffer deactivated\n", -1);
-        return;
-    }
-
-    virLogDumpAllFD(" dumping internal log buffer:\n", -1);
-    virLogDumpAllFD("\n\n    ====== start of log =====\n\n", -1);
-
-    /*
-     * Since we can't lock the buffer safely from a signal handler
-     * we mark it as empty in case of concurrent access, and proceed
-     * with the data, at worse we will output something a bit weird
-     * if another thread start logging messages at the same time.
-     * Note that virLogStr() uses virLogEnd for the computations and
-     * writes to the buffer and only then updates virLogLen and virLogStart
-     * so it's best to reset it first.
-     */
-    oldLogStart = virLogStart;
-    oldLogLen = virLogLen;
-    virLogEnd = 0;
-    virLogLen = 0;
-    virLogStart = 0;
-
-    while (oldLogLen > 0) {
-        if (oldLogStart + oldLogLen < virLogSize) {
-            virLogBuffer[oldLogStart + oldLogLen] = 0;
-            virLogDumpAllFD(&virLogBuffer[oldLogStart], oldLogLen);
-            oldLogStart += oldLogLen;
-            oldLogLen = 0;
-        } else {
-            len = virLogSize - oldLogStart;
-            virLogBuffer[virLogSize] = 0;
-            virLogDumpAllFD(&virLogBuffer[oldLogStart], len);
-            oldLogLen -= len;
-            oldLogStart = 0;
-        }
-    }
-    virLogDumpAllFD("\n\n     ====== end of log =====\n\n", -1);
-}
-
-
-/**
- * virLogSetDefaultPriority:
- * @priority: the default priority level
- *
- * Set the default priority level, i.e. any logged data of a priority
- * equal or superior to this level will be logged, unless a specific rule
- * was defined for the log category of the message.
- *
- * Returns 0 if successful, -1 in case of error.
- */
-int
-virLogSetDefaultPriority(virLogPriority priority)
-{
-    if ((priority < VIR_LOG_DEBUG) || (priority > VIR_LOG_ERROR)) {
-        VIR_WARN("Ignoring invalid log level setting.");
-        return -1;
-    }
-    if (virLogInitialize() < 0)
-        return -1;
-
-    virLogDefaultPriority = priority;
-    return 0;
-}
-
-
-/**
- * virLogResetFilters:
- *
- * Removes the set of logging filters defined.
- *
- * Returns the number of filters removed
- */
-static int
-virLogResetFilters(void)
-{
-    int i;
-
-    for (i = 0; i < virLogNbFilters;i++)
-        VIR_FREE(virLogFilters[i].match);
-    VIR_FREE(virLogFilters);
-    virLogNbFilters = 0;
-    return i;
-}
-
-
-/**
- * virLogDefineFilter:
- * @match: the pattern to match
- * @priority: the priority to give to messages matching the pattern
- * @flags: extra flags, see virLogFilterFlags enum
- *
- * Defines a pattern used for log filtering, it allow to select or
- * reject messages independently of the default priority.
- * The filter defines a rules that will apply only to messages matching
- * the pattern (currently if @match is a substring of the message category)
- *
- * Returns -1 in case of failure or the filter number if successful
- */
-int
-virLogDefineFilter(const char *match,
-                   virLogPriority priority,
-                   unsigned int flags)
-{
-    int i;
-    char *mdup = NULL;
-
-    virCheckFlags(VIR_LOG_STACK_TRACE, -1);
-
-    if ((match == NULL) || (priority < VIR_LOG_DEBUG) ||
-        (priority > VIR_LOG_ERROR))
-        return -1;
-
-    virLogLock();
-    for (i = 0;i < virLogNbFilters;i++) {
-        if (STREQ(virLogFilters[i].match, match)) {
-            virLogFilters[i].priority = priority;
-            goto cleanup;
-        }
-    }
-
-    mdup = strdup(match);
-    if (mdup == NULL) {
-        i = -1;
-        goto cleanup;
-    }
-    i = virLogNbFilters;
-    if (VIR_REALLOC_N(virLogFilters, virLogNbFilters + 1)) {
-        i = -1;
-        VIR_FREE(mdup);
-        goto cleanup;
-    }
-    virLogFilters[i].match = mdup;
-    virLogFilters[i].priority = priority;
-    virLogFilters[i].flags = flags;
-    virLogNbFilters++;
-cleanup:
-    virLogUnlock();
-    return i;
-}
-
-
-/**
- * virLogFiltersCheck:
- * @input: the input string
- *
- * Check the input of the message against the existing filters. Currently
- * the match is just a substring check of the category used as the input
- * string, a more subtle approach could be used instead
- *
- * Returns 0 if not matched or the new priority if found.
- */
-static int
-virLogFiltersCheck(const char *input,
-                   unsigned int *flags)
-{
-    int ret = 0;
-    int i;
-
-    virLogLock();
-    for (i = 0;i < virLogNbFilters;i++) {
-        if (strstr(input, virLogFilters[i].match)) {
-            ret = virLogFilters[i].priority;
-            *flags = virLogFilters[i].flags;
-            break;
-        }
-    }
-    virLogUnlock();
-    return ret;
-}
-
-
-/**
- * virLogResetOutputs:
- *
- * Removes the set of logging output defined.
- *
- * Returns the number of output removed
- */
-static int
-virLogResetOutputs(void)
-{
-    int i;
-
-    for (i = 0;i < virLogNbOutputs;i++) {
-        if (virLogOutputs[i].c != NULL)
-            virLogOutputs[i].c(virLogOutputs[i].data);
-        VIR_FREE(virLogOutputs[i].name);
-    }
-    VIR_FREE(virLogOutputs);
-    i = virLogNbOutputs;
-    virLogNbOutputs = 0;
-    return i;
-}
-
-
-/**
- * virLogDefineOutput:
- * @f: the function to call to output a message
- * @c: the function to call to close the output (or NULL)
- * @data: extra data passed as first arg to the function
- * @priority: minimal priority for this filter, use 0 for none
- * @dest: where to send output of this priority
- * @name: optional name data associated with an output
- * @flags: extra flag, currently unused
- *
- * Defines an output function for log messages. Each message once
- * gone though filtering is emitted through each registered output.
- *
- * Returns -1 in case of failure or the output number if successful
- */
-int
-virLogDefineOutput(virLogOutputFunc f,
-                   virLogCloseFunc c,
-                   void *data,
-                   virLogPriority priority,
-                   virLogDestination dest,
-                   const char *name,
-                   unsigned int flags)
-{
-    int ret = -1;
-    char *ndup = NULL;
-
-    virCheckFlags(0, -1);
-
-    if (f == NULL)
-        return -1;
-
-    if (dest == VIR_LOG_TO_SYSLOG || dest == VIR_LOG_TO_FILE) {
-        if (name == NULL)
-            return -1;
-        ndup = strdup(name);
-        if (ndup == NULL)
-            return -1;
-    }
-
-    virLogLock();
-    if (VIR_REALLOC_N(virLogOutputs, virLogNbOutputs + 1)) {
-        VIR_FREE(ndup);
-        goto cleanup;
-    }
-    ret = virLogNbOutputs++;
-    virLogOutputs[ret].logVersion = true;
-    virLogOutputs[ret].f = f;
-    virLogOutputs[ret].c = c;
-    virLogOutputs[ret].data = data;
-    virLogOutputs[ret].priority = priority;
-    virLogOutputs[ret].dest = dest;
-    virLogOutputs[ret].name = ndup;
-cleanup:
-    virLogUnlock();
-    return ret;
-}
-
-
-static int
-virLogFormatString(char **msg,
-                   int linenr,
-                   const char *funcname,
-                   virLogPriority priority,
-                   const char *str)
-{
-    int ret;
-
-    /*
-     * Be careful when changing the following log message formatting, we rely
-     * on it when stripping libvirt debug messages from qemu log files. So when
-     * changing this, you might also need to change the code there.
-     * virLogFormatString() function name is mentioned there so it's sufficient
-     * to just grep for it to find the right place.
-     */
-    if ((funcname != NULL)) {
-        ret = virAsprintf(msg, "%d: %s : %s:%d : %s\n",
-                          virThreadSelfID(), virLogPriorityString(priority),
-                          funcname, linenr, str);
-    } else {
-        ret = virAsprintf(msg, "%d: %s : %s\n",
-                          virThreadSelfID(), virLogPriorityString(priority),
-                          str);
-    }
-    return ret;
-}
-
-
-static int
-virLogVersionString(const char **rawmsg,
-                    char **msg)
-{
-#ifdef PACKAGER_VERSION
-# ifdef PACKAGER
-#  define LOG_VERSION_STRING \
-    "libvirt version: " VERSION ", package: " PACKAGER_VERSION " (" PACKAGER ")"
-# else
-#  define LOG_VERSION_STRING \
-    "libvirt version: " VERSION ", package: " PACKAGER_VERSION
-# endif
-#else
-# define LOG_VERSION_STRING  \
-    "libvirt version: " VERSION
-#endif
-
-    *rawmsg = LOG_VERSION_STRING;
-    return virLogFormatString(msg, 0, NULL, VIR_LOG_INFO, LOG_VERSION_STRING);
-}
-
-
-/**
- * virLogMessage:
- * @source: where is that message coming from
- * @priority: the priority level
- * @filename: file where the message was emitted
- * @linenr: line where the message was emitted
- * @funcname: the function emitting the (debug) message
- * @metadata: NULL or metadata array, terminated by an item with NULL key
- * @fmt: the string format
- * @...: the arguments
- *
- * Call the libvirt logger with some information. Based on the configuration
- * the message may be stored, sent to output or just discarded
- */
-void
-virLogMessage(virLogSource source,
-              virLogPriority priority,
-              const char *filename,
-              int linenr,
-              const char *funcname,
-              virLogMetadataPtr metadata,
-              const char *fmt, ...)
-{
-    va_list ap;
-    va_start(ap, fmt);
-    virLogVMessage(source, priority,
-                   filename, linenr, funcname,
-                   metadata, fmt, ap);
-    va_end(ap);
-}
-
-
-/**
- * virLogVMessage:
- * @source: where is that message coming from
- * @priority: the priority level
- * @filename: file where the message was emitted
- * @linenr: line where the message was emitted
- * @funcname: the function emitting the (debug) message
- * @metadata: NULL or metadata array, terminated by an item with NULL key
- * @fmt: the string format
- * @vargs: format args
- *
- * Call the libvirt logger with some information. Based on the configuration
- * the message may be stored, sent to output or just discarded
- */
-void
-virLogVMessage(virLogSource source,
-               virLogPriority priority,
-               const char *filename,
-               int linenr,
-               const char *funcname,
-               virLogMetadataPtr metadata,
-               const char *fmt,
-               va_list vargs)
-{
-    static bool logVersionStderr = true;
-    char *str = NULL;
-    char *msg = NULL;
-    char timestamp[VIR_TIME_STRING_BUFLEN];
-    int fprio, i, ret;
-    int saved_errno = errno;
-    int emit = 1;
-    unsigned int filterflags = 0;
-
-    if (virLogInitialize() < 0)
-        return;
-
-    if (fmt == NULL)
-        goto cleanup;
-
-    /*
-     * check against list of specific logging patterns
-     */
-    fprio = virLogFiltersCheck(filename, &filterflags);
-    if (fprio == 0) {
-        if (priority < virLogDefaultPriority)
-            emit = 0;
-    } else if (priority < fprio) {
-        emit = 0;
-    }
-
-    if ((emit == 0) && ((virLogBuffer == NULL) || (virLogSize <= 0)))
-        goto cleanup;
-
-    /*
-     * serialize the error message, add level and timestamp
-     */
-    if (virVasprintf(&str, fmt, vargs) < 0) {
-        goto cleanup;
-    }
-
-    ret = virLogFormatString(&msg, linenr, funcname, priority, str);
-    if (ret < 0)
-        goto cleanup;
-
-    if (virTimeStringNowRaw(timestamp) < 0)
-        timestamp[0] = '\0';
-
-    /*
-     * Log based on defaults, first store in the history buffer,
-     * then if emit push the message on the outputs defined, if none
-     * use stderr.
-     * NOTE: the locking is a single point of contention for multiple
-     *       threads, but avoid intermixing. Maybe set up locks per output
-     *       to improve paralellism.
-     */
-    virLogLock();
-    virLogStr(timestamp);
-    virLogStr(msg);
-    virLogUnlock();
-    if (emit == 0)
-        goto cleanup;
-
-    virLogLock();
-    for (i = 0; i < virLogNbOutputs; i++) {
-        if (priority >= virLogOutputs[i].priority) {
-            if (virLogOutputs[i].logVersion) {
-                const char *rawver;
-                char *ver = NULL;
-                if (virLogVersionString(&rawver, &ver) >= 0)
-                    virLogOutputs[i].f(VIR_LOG_FROM_FILE, VIR_LOG_INFO,
-                                       __FILE__, __LINE__, __func__,
-                                       timestamp, NULL, 0, rawver, ver,
-                                       virLogOutputs[i].data);
-                VIR_FREE(ver);
-                virLogOutputs[i].logVersion = false;
-            }
-            virLogOutputs[i].f(source, priority,
-                               filename, linenr, funcname,
-                               timestamp, metadata, filterflags,
-                               str, msg, virLogOutputs[i].data);
-        }
-    }
-    if ((virLogNbOutputs == 0) && (source != VIR_LOG_FROM_ERROR)) {
-        if (logVersionStderr) {
-            const char *rawver;
-            char *ver = NULL;
-            if (virLogVersionString(&rawver, &ver) >= 0)
-                virLogOutputToFd(VIR_LOG_FROM_FILE, VIR_LOG_INFO,
-                                 __FILE__, __LINE__, __func__,
-                                 timestamp, NULL, 0, rawver, ver,
-                                 (void *) STDERR_FILENO);
-            VIR_FREE(ver);
-            logVersionStderr = false;
-        }
-        virLogOutputToFd(source, priority,
-                         filename, linenr, funcname,
-                         timestamp, metadata, filterflags,
-                         str, msg, (void *) STDERR_FILENO);
-    }
-    virLogUnlock();
-
-cleanup:
-    VIR_FREE(str);
-    VIR_FREE(msg);
-    errno = saved_errno;
-}
-
-
-static void
-virLogStackTraceToFd(int fd)
-{
-    void *array[100];
-    int size;
-    static bool doneWarning = false;
-    const char *msg = "Stack trace not available on this platform\n";
-
-#define STRIP_DEPTH 3
-    size = backtrace(array, ARRAY_CARDINALITY(array));
-    if (size) {
-        backtrace_symbols_fd(array +  STRIP_DEPTH, size - STRIP_DEPTH, fd);
-        ignore_value(safewrite(fd, "\n", 1));
-    } else if (!doneWarning) {
-        ignore_value(safewrite(fd, msg, strlen(msg)));
-        doneWarning = true;
-    }
-#undef STRIP_DEPTH
-}
-
-static void
-virLogOutputToFd(virLogSource source ATTRIBUTE_UNUSED,
-                 virLogPriority priority ATTRIBUTE_UNUSED,
-                 const char *filename ATTRIBUTE_UNUSED,
-                 int linenr ATTRIBUTE_UNUSED,
-                 const char *funcname ATTRIBUTE_UNUSED,
-                 const char *timestamp,
-                 virLogMetadataPtr metadata ATTRIBUTE_UNUSED,
-                 unsigned int flags,
-                 const char *rawstr ATTRIBUTE_UNUSED,
-                 const char *str,
-                 void *data)
-{
-    int fd = (intptr_t) data;
-    char *msg;
-
-    if (fd < 0)
-        return;
-
-    if (virAsprintf(&msg, "%s: %s", timestamp, str) < 0)
-        return;
-
-    ignore_value(safewrite(fd, msg, strlen(msg)));
-    VIR_FREE(msg);
-
-    if (flags & VIR_LOG_STACK_TRACE)
-        virLogStackTraceToFd(fd);
-}
-
-
-static void
-virLogCloseFd(void *data)
-{
-    int fd = (intptr_t) data;
-
-    VIR_LOG_CLOSE(fd);
-}
-
-
-static int
-virLogAddOutputToStderr(virLogPriority priority)
-{
-    if (virLogDefineOutput(virLogOutputToFd, NULL, (void *)2L, priority,
-                           VIR_LOG_TO_STDERR, NULL, 0) < 0)
-        return -1;
-    return 0;
-}
-
-
-static int
-virLogAddOutputToFile(virLogPriority priority,
-                      const char *file)
-{
-    int fd;
-
-    fd = open(file, O_CREAT | O_APPEND | O_WRONLY, S_IRUSR | S_IWUSR);
-    if (fd < 0)
-        return -1;
-    if (virLogDefineOutput(virLogOutputToFd, virLogCloseFd,
-                           (void *)(intptr_t)fd,
-                           priority, VIR_LOG_TO_FILE, file, 0) < 0) {
-        VIR_FORCE_CLOSE(fd);
-        return -1;
-    }
-    return 0;
-}
-
-
-#if HAVE_SYSLOG_H
-static int
-virLogPrioritySyslog(virLogPriority priority)
-{
-    switch (priority) {
-    case VIR_LOG_DEBUG:
-        return LOG_DEBUG;
-    case VIR_LOG_INFO:
-        return LOG_INFO;
-    case VIR_LOG_WARN:
-        return LOG_WARNING;
-    case VIR_LOG_ERROR:
-        return LOG_ERR;
-    default:
-        return LOG_ERR;
-    }
-}
-
-
-static void
-virLogOutputToSyslog(virLogSource source ATTRIBUTE_UNUSED,
-                     virLogPriority priority,
-                     const char *filename ATTRIBUTE_UNUSED,
-                     int linenr ATTRIBUTE_UNUSED,
-                     const char *funcname ATTRIBUTE_UNUSED,
-                     const char *timestamp ATTRIBUTE_UNUSED,
-                     virLogMetadataPtr metadata ATTRIBUTE_UNUSED,
-                     unsigned int flags,
-                     const char *rawstr ATTRIBUTE_UNUSED,
-                     const char *str,
-                     void *data ATTRIBUTE_UNUSED)
-{
-    virCheckFlags(VIR_LOG_STACK_TRACE,);
-
-    syslog(virLogPrioritySyslog(priority), "%s", str);
-}
-
-static char *current_ident = NULL;
-
-
-static void
-virLogCloseSyslog(void *data ATTRIBUTE_UNUSED)
-{
-    closelog();
-    VIR_FREE(current_ident);
-}
-
-
-static int
-virLogAddOutputToSyslog(virLogPriority priority,
-                        const char *ident)
-{
-    /*
-     * ident needs to be kept around on Solaris
-     */
-    VIR_FREE(current_ident);
-    current_ident = strdup(ident);
-    if (current_ident == NULL)
-        return -1;
-
-    openlog(current_ident, 0, 0);
-    if (virLogDefineOutput(virLogOutputToSyslog, virLogCloseSyslog, NULL,
-                           priority, VIR_LOG_TO_SYSLOG, ident, 0) < 0) {
-        closelog();
-        VIR_FREE(current_ident);
-        return -1;
-    }
-    return 0;
-}
-
-
-# if USE_JOURNALD
-#  define IOVEC_SET(iov, data, size)            \
-    do {                                        \
-        struct iovec *_i = &(iov);              \
-        _i->iov_base = (void*)(data);           \
-        _i->iov_len = (size);                   \
-    } while (0)
-
-#  define IOVEC_SET_STRING(iov, str) IOVEC_SET(iov, str, strlen(str))
-
-/* Used for conversion of numbers to strings, and for length of binary data */
-#  define JOURNAL_BUF_SIZE (MAX(INT_BUFSIZE_BOUND(int), sizeof(uint64_t)))
-
-struct journalState
-{
-    struct iovec *iov, *iov_end;
-    char (*bufs)[JOURNAL_BUF_SIZE], (*bufs_end)[JOURNAL_BUF_SIZE];
-};
-
-static void
-journalAddString(struct journalState *state, const char *field,
-                 const char *value)
-{
-    static const char newline = '\n', equals = '=';
-
-    if (strchr(value, '\n') != NULL) {
-        uint64_t nstr;
-
-        /* If 'str' contains a newline, then we must
-         * encode the string length, since we can't
-         * rely on the newline for the field separator
-         */
-        if (state->iov_end - state->iov < 5 || state->bufs == state->bufs_end)
-            return; /* Silently drop */
-        nstr = htole64(strlen(value));
-        memcpy(state->bufs[0], &nstr, sizeof(nstr));
-
-        IOVEC_SET_STRING(state->iov[0], field);
-        IOVEC_SET(state->iov[1], &newline, sizeof(newline));
-        IOVEC_SET(state->iov[2], state->bufs[0], sizeof(nstr));
-        state->bufs++;
-        state->iov += 3;
-    } else {
-        if (state->iov_end - state->iov < 4)
-            return; /* Silently drop */
-        IOVEC_SET_STRING(state->iov[0], field);
-        IOVEC_SET(state->iov[1], (void *)&equals, sizeof(equals));
-        state->iov += 2;
-    }
-    IOVEC_SET_STRING(state->iov[0], value);
-    IOVEC_SET(state->iov[1], (void *)&newline, sizeof(newline));
-    state->iov += 2;
-}
-
-static void
-journalAddInt(struct journalState *state, const char *field, int value)
-{
-    static const char newline = '\n', equals = '=';
-
-    char *num;
-
-    if (state->iov_end - state->iov < 4 || state->bufs == state->bufs_end)
-        return; /* Silently drop */
-
-    num = virFormatIntDecimal(state->bufs[0], sizeof(state->bufs[0]), value);
-
-    IOVEC_SET_STRING(state->iov[0], field);
-    IOVEC_SET(state->iov[1], (void *)&equals, sizeof(equals));
-    IOVEC_SET_STRING(state->iov[2], num);
-    IOVEC_SET(state->iov[3], (void *)&newline, sizeof(newline));
-    state->bufs++;
-    state->iov += 4;
-}
-
-static int journalfd = -1;
-
-static void
-virLogOutputToJournald(virLogSource source,
-                       virLogPriority priority,
-                       const char *filename,
-                       int linenr,
-                       const char *funcname,
-                       const char *timestamp ATTRIBUTE_UNUSED,
-                       virLogMetadataPtr metadata ATTRIBUTE_UNUSED,
-                       unsigned int flags,
-                       const char *rawstr,
-                       const char *str ATTRIBUTE_UNUSED,
-                       void *data ATTRIBUTE_UNUSED)
-{
-    virCheckFlags(VIR_LOG_STACK_TRACE,);
-    int buffd = -1;
-    struct msghdr mh;
-    struct sockaddr_un sa;
-    union {
-        struct cmsghdr cmsghdr;
-        uint8_t buf[CMSG_SPACE(sizeof(int))];
-    } control;
-    struct cmsghdr *cmsg;
-    /* We use /dev/shm instead of /tmp here, since we want this to
-     * be a tmpfs, and one that is available from early boot on
-     * and where unprivileged users can create files. */
-    char path[] = "/dev/shm/journal.XXXXXX";
-
-#  define NUM_FIELDS 6
-    struct iovec iov[NUM_FIELDS * 5];
-    char iov_bufs[NUM_FIELDS][JOURNAL_BUF_SIZE];
-    struct journalState state;
-
-    state.iov = iov;
-    state.iov_end = iov + ARRAY_CARDINALITY(iov);
-    state.bufs = iov_bufs;
-    state.bufs_end = iov_bufs + ARRAY_CARDINALITY(iov_bufs);
-
-    journalAddString(&state ,"MESSAGE", rawstr);
-    journalAddInt(&state, "PRIORITY", priority);
-    journalAddString(&state, "LIBVIRT_SOURCE",
-                     virLogSourceTypeToString(source));
-    journalAddString(&state, "CODE_FILE", filename);
-    journalAddInt(&state, "CODE_LINE", linenr);
-    journalAddString(&state, "CODE_FUNC", funcname);
-
-    memset(&sa, 0, sizeof(sa));
-    sa.sun_family = AF_UNIX;
-    if (!virStrcpy(sa.sun_path, "/run/systemd/journal/socket", sizeof(sa.sun_path)))
-        return;
-
-    memset(&mh, 0, sizeof(mh));
-    mh.msg_name = &sa;
-    mh.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(sa.sun_path);
-    mh.msg_iov = iov;
-    mh.msg_iovlen = state.iov - iov;
-
-    if (sendmsg(journalfd, &mh, MSG_NOSIGNAL) >= 0)
-        return;
-
-    if (errno != EMSGSIZE && errno != ENOBUFS)
-        return;
-
-    /* Message was too large, so dump to temporary file
-     * and pass an FD to the journal
-     */
-
-    /* NB: mkostemp is not declared async signal safe by
-     * POSIX, but this is Linux only code and the GLibc
-     * impl is safe enough, only using open() and inline
-     * asm to read a timestamp (falling back to gettimeofday
-     * on some arches
-     */
-    if ((buffd = mkostemp(path, O_CLOEXEC|O_RDWR)) < 0)
-        return;
-
-    if (unlink(path) < 0)
-        goto cleanup;
-
-    if (writev(buffd, iov, state.iov - iov) < 0)
-        goto cleanup;
-
-    mh.msg_iov = NULL;
-    mh.msg_iovlen = 0;
-
-    memset(&control, 0, sizeof(control));
-    mh.msg_control = &control;
-    mh.msg_controllen = sizeof(control);
-
-    cmsg = CMSG_FIRSTHDR(&mh);
-    cmsg->cmsg_level = SOL_SOCKET;
-    cmsg->cmsg_type = SCM_RIGHTS;
-    cmsg->cmsg_len = CMSG_LEN(sizeof(int));
-    memcpy(CMSG_DATA(cmsg), &buffd, sizeof(int));
-
-    mh.msg_controllen = cmsg->cmsg_len;
-
-    sendmsg(journalfd, &mh, MSG_NOSIGNAL);
-
-cleanup:
-    VIR_LOG_CLOSE(buffd);
-}
-
-
-static void virLogCloseJournald(void *data ATTRIBUTE_UNUSED)
-{
-    VIR_LOG_CLOSE(journalfd);
-}
-
-
-static int virLogAddOutputToJournald(int priority)
-{
-    if ((journalfd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0)
-        return -1;
-    if (virSetInherit(journalfd, false) < 0) {
-        VIR_LOG_CLOSE(journalfd);
-        return -1;
-    }
-    if (virLogDefineOutput(virLogOutputToJournald, virLogCloseJournald, NULL,
-                           priority, VIR_LOG_TO_JOURNALD, NULL, 0) < 0) {
-        return -1;
-    }
-    return 0;
-}
-# endif /* USE_JOURNALD */
-#endif /* HAVE_SYSLOG_H */
-
-#define IS_SPACE(cur)                                                   \
-    ((*cur == ' ') || (*cur == '\t') || (*cur == '\n') ||               \
-     (*cur == '\r') || (*cur == '\\'))
-
-
-/**
- * virLogParseOutputs:
- * @outputs: string defining a (set of) output(s)
- *
- * The format for an output can be:
- *    x:stderr
- *       output goes to stderr
- *    x:syslog:name
- *       use syslog for the output and use the given name as the ident
- *    x:file:file_path
- *       output to a file, with the given filepath
- * In all case the x prefix is the minimal level, acting as a filter
- *    0: everything
- *    1: DEBUG
- *    2: INFO
- *    3: WARNING
- *    4: ERROR
- *
- * Multiple output can be defined in a single @output, they just need to be
- * separated by spaces.
- *
- * Returns the number of output parsed and installed or -1 in case of error
- */
-int
-virLogParseOutputs(const char *outputs)
-{
-    const char *cur = outputs, *str;
-    char *name;
-    char *abspath;
-    virLogPriority prio;
-    int ret = -1;
-    int count = 0;
-
-    if (cur == NULL)
-        return -1;
-
-    VIR_DEBUG("outputs=%s", outputs);
-
-    virSkipSpaces(&cur);
-    while (*cur != 0) {
-        prio= virParseNumber(&cur);
-        if ((prio < VIR_LOG_DEBUG) || (prio > VIR_LOG_ERROR))
-            goto cleanup;
-        if (*cur != ':')
-            goto cleanup;
-        cur++;
-        if (STREQLEN(cur, "stderr", 6)) {
-            cur += 6;
-            if (virLogAddOutputToStderr(prio) == 0)
-                count++;
-        } else if (STREQLEN(cur, "syslog", 6)) {
-            cur += 6;
-            if (*cur != ':')
-                goto cleanup;
-            cur++;
-            str = cur;
-            while ((*cur != 0) && (!IS_SPACE(cur)))
-                cur++;
-            if (str == cur)
-                goto cleanup;
-#if HAVE_SYSLOG_H
-            name = strndup(str, cur - str);
-            if (name == NULL)
-                goto cleanup;
-            if (virLogAddOutputToSyslog(prio, name) == 0)
-                count++;
-            VIR_FREE(name);
-#endif /* HAVE_SYSLOG_H */
-        } else if (STREQLEN(cur, "file", 4)) {
-            cur += 4;
-            if (*cur != ':')
-                goto cleanup;
-            cur++;
-            str = cur;
-            while ((*cur != 0) && (!IS_SPACE(cur)))
-                cur++;
-            if (str == cur)
-                goto cleanup;
-            name = strndup(str, cur - str);
-            if (name == NULL)
-                goto cleanup;
-            if (virFileAbsPath(name, &abspath) < 0) {
-                VIR_FREE(name);
-                return -1; /* skip warning here because setting was fine */
-            }
-            if (virLogAddOutputToFile(prio, abspath) == 0)
-                count++;
-            VIR_FREE(name);
-            VIR_FREE(abspath);
-        } else if (STREQLEN(cur, "journald", 8)) {
-            cur += 8;
-#if USE_JOURNALD
-            if (virLogAddOutputToJournald(prio) == 0)
-                count++;
-#endif /* USE_JOURNALD */
-        } else {
-            goto cleanup;
-        }
-        virSkipSpaces(&cur);
-    }
-    ret = count;
-cleanup:
-    if (ret == -1)
-        VIR_WARN("Ignoring invalid log output setting.");
-    return ret;
-}
-
-
-/**
- * virLogParseFilters:
- * @filters: string defining a (set of) filter(s)
- *
- * The format for a filter is:
- *    x:name
- *       where name is a match string
- * the x prefix is the minimal level where the messages should be logged
- *    1: DEBUG
- *    2: INFO
- *    3: WARNING
- *    4: ERROR
- *
- * Multiple filter can be defined in a single @filters, they just need to be
- * separated by spaces.
- *
- * Returns the number of filter parsed and installed or -1 in case of error
- */
-int
-virLogParseFilters(const char *filters)
-{
-    const char *cur = filters, *str;
-    char *name;
-    virLogPriority prio;
-    int ret = -1;
-    int count = 0;
-
-    if (cur == NULL)
-        return -1;
-
-    virSkipSpaces(&cur);
-    while (*cur != 0) {
-        unsigned int flags = 0;
-        prio= virParseNumber(&cur);
-        if ((prio < VIR_LOG_DEBUG) || (prio > VIR_LOG_ERROR))
-            goto cleanup;
-        if (*cur != ':')
-            goto cleanup;
-        cur++;
-        if (*cur == '+') {
-            flags |= VIR_LOG_STACK_TRACE;
-            cur++;
-        }
-        str = cur;
-        while ((*cur != 0) && (!IS_SPACE(cur)))
-            cur++;
-        if (str == cur)
-            goto cleanup;
-        name = strndup(str, cur - str);
-        if (name == NULL)
-            goto cleanup;
-        if (virLogDefineFilter(name, prio, flags) >= 0)
-            count++;
-        VIR_FREE(name);
-        virSkipSpaces(&cur);
-    }
-    ret = count;
-cleanup:
-    if (ret == -1)
-        VIR_WARN("Ignoring invalid log filter setting.");
-    return ret;
-}
-
-
-/**
- * virLogGetDefaultPriority:
- *
- * Returns the current logging priority level.
- */
-virLogPriority
-virLogGetDefaultPriority(void)
-{
-    return virLogDefaultPriority;
-}
-
-
-/**
- * virLogGetFilters:
- *
- * Returns a string listing the current filters, in the format originally
- * specified in the config file or environment. Caller must free the
- * result.
- */
-char *
-virLogGetFilters(void)
-{
-    int i;
-    virBuffer filterbuf = VIR_BUFFER_INITIALIZER;
-
-    virLogLock();
-    for (i = 0; i < virLogNbFilters; i++) {
-        const char *sep = ":";
-        if (virLogFilters[i].flags & VIR_LOG_STACK_TRACE)
-            sep = ":+";
-        virBufferAsprintf(&filterbuf, "%d%s%s ",
-                          virLogFilters[i].priority,
-                          sep,
-                          virLogFilters[i].match);
-    }
-    virLogUnlock();
-
-    if (virBufferError(&filterbuf)) {
-        virBufferFreeAndReset(&filterbuf);
-        return NULL;
-    }
-
-    return virBufferContentAndReset(&filterbuf);
-}
-
-
-/**
- * virLogGetOutputs:
- *
- * Returns a string listing the current outputs, in the format originally
- * specified in the config file or environment. Caller must free the
- * result.
- */
-char *
-virLogGetOutputs(void)
-{
-    int i;
-    virBuffer outputbuf = VIR_BUFFER_INITIALIZER;
-
-    virLogLock();
-    for (i = 0; i < virLogNbOutputs; i++) {
-        virLogDestination dest = virLogOutputs[i].dest;
-        if (i)
-            virBufferAsprintf(&outputbuf, " ");
-        switch (dest) {
-            case VIR_LOG_TO_SYSLOG:
-            case VIR_LOG_TO_FILE:
-                virBufferAsprintf(&outputbuf, "%d:%s:%s",
-                                  virLogOutputs[i].priority,
-                                  virLogOutputString(dest),
-                                  virLogOutputs[i].name);
-                break;
-            default:
-                virBufferAsprintf(&outputbuf, "%d:%s",
-                                  virLogOutputs[i].priority,
-                                  virLogOutputString(dest));
-        }
-    }
-    virLogUnlock();
-
-    if (virBufferError(&outputbuf)) {
-        virBufferFreeAndReset(&outputbuf);
-        return NULL;
-    }
-
-    return virBufferContentAndReset(&outputbuf);
-}
-
-
-/**
- * virLogGetNbFilters:
- *
- * Returns the current number of defined log filters.
- */
-int
-virLogGetNbFilters(void)
-{
-    return virLogNbFilters;
-}
-
-
-/**
- * virLogGetNbOutputs:
- *
- * Returns the current number of defined log outputs.
- */
-int
-virLogGetNbOutputs(void)
-{
-    return virLogNbOutputs;
-}
-
-
-/**
- * virLogParseDefaultPriority:
- * @priority: string defining the desired logging level
- *
- * Parses and sets the default log priority level. It can take a string or
- * number corresponding to the following levels:
- *    1: DEBUG
- *    2: INFO
- *    3: WARNING
- *    4: ERROR
- *
- * Returns the parsed log level or -1 on error.
- */
-int
-virLogParseDefaultPriority(const char *priority)
-{
-    int ret = -1;
-
-    if (STREQ(priority, "1") || STREQ(priority, "debug"))
-        ret = virLogSetDefaultPriority(VIR_LOG_DEBUG);
-    else if (STREQ(priority, "2") || STREQ(priority, "info"))
-        ret = virLogSetDefaultPriority(VIR_LOG_INFO);
-    else if (STREQ(priority, "3") || STREQ(priority, "warning"))
-        ret = virLogSetDefaultPriority(VIR_LOG_WARN);
-    else if (STREQ(priority, "4") || STREQ(priority, "error"))
-        ret = virLogSetDefaultPriority(VIR_LOG_ERROR);
-    else
-        VIR_WARN("Ignoring invalid log level setting");
-
-    return ret;
-}
-
-
-/**
- * virLogSetFromEnv:
- *
- * Sets virLogDefaultPriority, virLogFilters and virLogOutputs based on
- * environment variables.
- */
-void
-virLogSetFromEnv(void)
-{
-    char *debugEnv;
-
-    debugEnv = getenv("LIBVIRT_DEBUG");
-    if (debugEnv && *debugEnv)
-        virLogParseDefaultPriority(debugEnv);
-    debugEnv = getenv("LIBVIRT_LOG_FILTERS");
-    if (debugEnv && *debugEnv)
-        virLogParseFilters(debugEnv);
-    debugEnv = getenv("LIBVIRT_LOG_OUTPUTS");
-    if (debugEnv && *debugEnv)
-        virLogParseOutputs(debugEnv);
-}
diff --git a/src/util/logging.h b/src/util/logging.h
deleted file mode 100644
index 028b791..0000000
--- a/src/util/logging.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * logging.h: internal logging and debugging
- *
- * Copyright (C) 2006-2008, 2011-2012 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef __VIRTLOG_H_
-# define __VIRTLOG_H_
-
-# include "internal.h"
-# include "virbuffer.h"
-
-/*
- * To be made public
- */
-typedef enum {
-    VIR_LOG_DEBUG = 1,
-    VIR_LOG_INFO,
-    VIR_LOG_WARN,
-    VIR_LOG_ERROR,
-} virLogPriority;
-
-# define VIR_LOG_DEFAULT VIR_LOG_WARN
-
-typedef enum {
-    VIR_LOG_TO_STDERR = 1,
-    VIR_LOG_TO_SYSLOG,
-    VIR_LOG_TO_FILE,
-    VIR_LOG_TO_JOURNALD,
-} virLogDestination;
-
-typedef enum {
-    VIR_LOG_FROM_FILE,
-    VIR_LOG_FROM_ERROR,
-    VIR_LOG_FROM_AUDIT,
-    VIR_LOG_FROM_TRACE,
-    VIR_LOG_FROM_LIBRARY,
-
-    VIR_LOG_FROM_LAST,
-} virLogSource;
-
-/*
- * If configured with --enable-debug=yes then library calls
- * are printed to stderr for debugging or to an appropriate channel
- * defined at runtime from the libvirt daemon configuration file
- */
-# ifdef ENABLE_DEBUG
-#  define VIR_DEBUG_INT(src, filename, linenr, funcname, ...)           \
-    virLogMessage(src, VIR_LOG_DEBUG, filename, linenr, funcname, NULL, __VA_ARGS__)
-# else
-/**
- * virLogEatParams:
- *
- * Do nothing but eat parameters.
- */
-static inline void virLogEatParams(virLogSource unused, ...)
-{
-    /* Silence gcc */
-    unused = unused;
-}
-#  define VIR_DEBUG_INT(src, filename, linenr, funcname, ...)           \
-    virLogEatParams(src, filename, linenr, funcname, __VA_ARGS__)
-# endif /* !ENABLE_DEBUG */
-
-# define VIR_INFO_INT(src, filename, linenr, funcname, ...)             \
-    virLogMessage(src, VIR_LOG_INFO, filename, linenr, funcname, NULL, __VA_ARGS__)
-# define VIR_WARN_INT(src, filename, linenr, funcname, ...)             \
-    virLogMessage(src, VIR_LOG_WARN, filename, linenr, funcname, NULL, __VA_ARGS__)
-# define VIR_ERROR_INT(src, filename, linenr, funcname, ...)            \
-    virLogMessage(src, VIR_LOG_ERROR, filename, linenr, funcname, NULL, __VA_ARGS__)
-
-# define VIR_DEBUG(...)                                                 \
-    VIR_DEBUG_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
-# define VIR_INFO(...)                                                  \
-    VIR_INFO_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
-# define VIR_WARN(...)                                                  \
-    VIR_WARN_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
-# define VIR_ERROR(...)                                                 \
-    VIR_ERROR_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
-
-
-struct _virLogMetadata {
-    const char *key;
-    const char *s;              /* String value, or NULL to use "i" */
-    int i;
-};
-
-typedef struct _virLogMetadata virLogMetadata;
-typedef struct _virLogMetadata *virLogMetadataPtr;
-
-/**
- * virLogOutputFunc:
- * @src: the src for the message
- * @priority: the priority for the message
- * @filename: file where the message was emitted
- * @linenr: line where the message was emitted
- * @funcname: the function emitting the message
- * @timestamp: zero terminated string with timestamp of the message
- * @metadata: NULL or metadata array, terminated by an item with NULL key
- * @flags: flags associated with the message
- * @rawstr: the unformatted message to log, zero terminated
- * @str: the message to log, preformatted and zero terminated
- * @data: extra output logging data
- *
- * Callback function used to output messages
- */
-typedef void (*virLogOutputFunc) (virLogSource src,
-                                  virLogPriority priority,
-                                  const char *filename,
-                                  int linenr,
-                                  const char *funcname,
-                                  const char *timestamp,
-                                  virLogMetadataPtr metadata,
-                                  unsigned int flags,
-                                  const char *rawstr,
-                                  const char *str,
-                                  void *data);
-
-/**
- * virLogCloseFunc:
- * @data: extra output logging data
- *
- * Callback function used to close a log output
- */
-typedef void (*virLogCloseFunc) (void *data);
-
-typedef enum {
-    VIR_LOG_STACK_TRACE = (1 << 0),
-} virLogFlags;
-
-extern int virLogGetNbFilters(void);
-extern int virLogGetNbOutputs(void);
-extern char *virLogGetFilters(void);
-extern char *virLogGetOutputs(void);
-extern virLogPriority virLogGetDefaultPriority(void);
-extern int virLogSetDefaultPriority(virLogPriority priority);
-extern void virLogSetFromEnv(void);
-extern int virLogDefineFilter(const char *match,
-                              virLogPriority priority,
-                              unsigned int flags);
-extern int virLogDefineOutput(virLogOutputFunc f,
-                              virLogCloseFunc c,
-                              void *data,
-                              virLogPriority priority,
-                              virLogDestination dest,
-                              const char *name,
-                              unsigned int flags);
-
-/*
- * Internal logging API
- */
-
-extern void virLogLock(void);
-extern void virLogUnlock(void);
-extern int virLogReset(void);
-extern int virLogParseDefaultPriority(const char *priority);
-extern int virLogParseFilters(const char *filters);
-extern int virLogParseOutputs(const char *output);
-extern void virLogMessage(virLogSource src,
-                          virLogPriority priority,
-                          const char *filename,
-                          int linenr,
-                          const char *funcname,
-                          virLogMetadataPtr metadata,
-                          const char *fmt, ...) ATTRIBUTE_FMT_PRINTF(7, 8);
-extern void virLogVMessage(virLogSource src,
-                           virLogPriority priority,
-                           const char *filename,
-                           int linenr,
-                           const char *funcname,
-                           virLogMetadataPtr metadata,
-                           const char *fmt,
-                           va_list vargs) ATTRIBUTE_FMT_PRINTF(7, 0);
-extern int virLogSetBufferSize(int size);
-extern void virLogEmergencyDumpAll(int signum);
-#endif
diff --git a/src/util/memory.c b/src/util/memory.c
index b224f30..186d3b6 100644
--- a/src/util/memory.c
+++ b/src/util/memory.c
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 
 #if TEST_OOM
 static int testMallocNext = 0;
diff --git a/src/util/pci.c b/src/util/pci.c
index bf46fca..7adce75 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -34,7 +34,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "vircommand.h"
 #include "virterror_internal.h"
diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index eebf59a..6c3390b 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -37,7 +37,7 @@
 #include "dirname.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "c-ctype.h"
 #include "vircommand.h"
diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index e21cbfd..5690f95 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -33,7 +33,7 @@
 #include "virterror_internal.h"
 #include "sysinfo.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "vircommand.h"
 
diff --git a/src/util/util.c b/src/util/util.c
index f8ba7b4..f941dfd 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -76,7 +76,7 @@
 #include "c-ctype.h"
 #include "dirname.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virbuffer.h"
 #include "util.h"
 #include "storage_file.h"
diff --git a/src/util/uuid.c b/src/util/uuid.c
index 5c3b32c..6efc7be 100644
--- a/src/util/uuid.c
+++ b/src/util/uuid.c
@@ -37,7 +37,7 @@
 #include "internal.h"
 #include "util.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "virfile.h"
 #include "virrandom.h"
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index 9bdc5ed..c4e0129 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -28,7 +28,7 @@
 #include <unistd.h>
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "viraudit.h"
 #include "util.h"
 #include "virfile.h"
diff --git a/src/util/virauth.c b/src/util/virauth.c
index 6d9935d..a1bad6a 100644
--- a/src/util/virauth.c
+++ b/src/util/virauth.c
@@ -27,7 +27,7 @@
 #include "virauth.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "virterror_internal.h"
 #include "configmake.h"
diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c
index 49a4466..46ba040 100644
--- a/src/util/virauthconfig.c
+++ b/src/util/virauthconfig.c
@@ -27,7 +27,7 @@
 #include "virkeyfile.h"
 #include "memory.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 
 
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index e9fc67f..82e6613 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -41,7 +41,7 @@
 #include "util.h"
 #include "memory.h"
 #include "vircgroup.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "virhash.h"
 #include "virhashcode.h"
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 3046658..7bed04e 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -37,7 +37,7 @@
 #include "memory.h"
 #include "virterror_internal.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "virpidfile.h"
 #include "virprocess.h"
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 221a1eb..c12a0bb 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -35,7 +35,7 @@
 #include "virconf.h"
 #include "util.h"
 #include "c-ctype.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "virfile.h"
 
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index 2a96778..b6c6642 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -24,7 +24,7 @@
 #include "virdbus.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "threads.h"
 
 #define VIR_FROM_THIS VIR_FROM_DBUS
diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 4a32f49..7bb42fc 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -45,7 +45,7 @@
 #include "vircommand.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 
 #define VIR_FROM_THIS VIR_FROM_NETWORK
diff --git a/src/util/virebtables.c b/src/util/virebtables.c
index 8474b2a..8333c38 100644
--- a/src/util/virebtables.c
+++ b/src/util/virebtables.c
@@ -44,7 +44,7 @@
 #include "vircommand.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "threads.h"
 
 #if HAVE_FIREWALLD
diff --git a/src/util/virevent.c b/src/util/virevent.c
index 7d11f85..573b4ac 100644
--- a/src/util/virevent.c
+++ b/src/util/virevent.c
@@ -25,7 +25,7 @@
 
 #include "virevent.h"
 #include "vireventpoll.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 
 #include <stdlib.h>
diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c
index 9fd196d..0256d83 100644
--- a/src/util/vireventpoll.c
+++ b/src/util/vireventpoll.c
@@ -32,7 +32,7 @@
 #include <fcntl.h>
 
 #include "threads.h"
-#include "logging.h"
+#include "virlog.h"
 #include "vireventpoll.h"
 #include "memory.h"
 #include "util.h"
diff --git a/src/util/virfile.c b/src/util/virfile.c
index d77b726..30294a2 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -41,7 +41,7 @@
 #include "configmake.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virhash.c b/src/util/virhash.c
index 1576dd3..077abca 100644
--- a/src/util/virhash.c
+++ b/src/util/virhash.c
@@ -27,7 +27,7 @@
 #include "virterror_internal.h"
 #include "virhash.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virhashcode.h"
 #include "virrandom.h"
 
diff --git a/src/util/virhooks.c b/src/util/virhooks.c
index 4a732ff..2e8ecf2 100644
--- a/src/util/virhooks.c
+++ b/src/util/virhooks.c
@@ -33,7 +33,7 @@
 #include "virterror_internal.h"
 #include "virhooks.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "virfile.h"
 #include "configmake.h"
diff --git a/src/util/viriptables.c b/src/util/viriptables.c
index 8831920..ee3e9a0 100644
--- a/src/util/viriptables.c
+++ b/src/util/viriptables.c
@@ -42,7 +42,7 @@
 #include "vircommand.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "threads.h"
 
 #if HAVE_FIREWALLD
diff --git a/src/util/virjson.c b/src/util/virjson.c
index a07dd5c..18a28ba 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -26,7 +26,7 @@
 #include "virjson.h"
 #include "memory.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 
 #if HAVE_YAJL
diff --git a/src/util/virkeyfile.c b/src/util/virkeyfile.c
index 3c2ce26..b43b92d 100644
--- a/src/util/virkeyfile.c
+++ b/src/util/virkeyfile.c
@@ -26,7 +26,7 @@
 #include <stdio.h>
 
 #include "c-ctype.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "util.h"
 #include "virhash.h"
diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c
index 99b6182..b652294 100644
--- a/src/util/virlockspace.c
+++ b/src/util/virlockspace.c
@@ -22,7 +22,7 @@
 #include <config.h>
 
 #include "virlockspace.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "virterror_internal.h"
 #include "util.h"
diff --git a/src/util/virlog.c b/src/util/virlog.c
new file mode 100644
index 0000000..d179de2
--- /dev/null
+++ b/src/util/virlog.c
@@ -0,0 +1,1590 @@
+/*
+ * logging.c: internal logging and debugging
+ *
+ * Copyright (C) 2008, 2010-2012 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <signal.h>
+#include <execinfo.h>
+#if HAVE_SYSLOG_H
+# include <syslog.h>
+#endif
+#include <sys/socket.h>
+#if HAVE_SYS_UN_H
+# include <sys/un.h>
+#endif
+
+#include "virterror_internal.h"
+#include "virlog.h"
+#include "memory.h"
+#include "util.h"
+#include "virbuffer.h"
+#include "threads.h"
+#include "virfile.h"
+#include "virtime.h"
+#include "intprops.h"
+
+/* Journald output is only supported on Linux new enough to expose
+ * htole64.  */
+#if HAVE_SYSLOG_H && defined(__linux__) && HAVE_DECL_HTOLE64
+# define USE_JOURNALD 1
+#endif
+
+#define VIR_FROM_THIS VIR_FROM_NONE
+
+VIR_ENUM_DECL(virLogSource)
+VIR_ENUM_IMPL(virLogSource, VIR_LOG_FROM_LAST,
+              "file",
+              "error",
+              "audit",
+              "trace",
+              "library");
+
+/*
+ * A logging buffer to keep some history over logs
+ */
+
+static int virLogSize = 64 * 1024;
+static char *virLogBuffer = NULL;
+static int virLogLen = 0;
+static int virLogStart = 0;
+static int virLogEnd = 0;
+
+/*
+ * Filters are used to refine the rules on what to keep or drop
+ * based on a matching pattern (currently a substring)
+ */
+struct _virLogFilter {
+    const char *match;
+    virLogPriority priority;
+    unsigned int flags;
+};
+typedef struct _virLogFilter virLogFilter;
+typedef virLogFilter *virLogFilterPtr;
+
+static virLogFilterPtr virLogFilters = NULL;
+static int virLogNbFilters = 0;
+
+/*
+ * Outputs are used to emit the messages retained
+ * after filtering, multiple output can be used simultaneously
+ */
+struct _virLogOutput {
+    bool logVersion;
+    void *data;
+    virLogOutputFunc f;
+    virLogCloseFunc c;
+    virLogPriority priority;
+    virLogDestination dest;
+    const char *name;
+};
+typedef struct _virLogOutput virLogOutput;
+typedef virLogOutput *virLogOutputPtr;
+
+static virLogOutputPtr virLogOutputs = NULL;
+static int virLogNbOutputs = 0;
+
+/*
+ * Default priorities
+ */
+static virLogPriority virLogDefaultPriority = VIR_LOG_DEFAULT;
+
+static int virLogResetFilters(void);
+static int virLogResetOutputs(void);
+static void virLogOutputToFd(virLogSource src,
+                             virLogPriority priority,
+                             const char *filename,
+                             int linenr,
+                             const char *funcname,
+                             const char *timestamp,
+                             virLogMetadataPtr metadata,
+                             unsigned int flags,
+                             const char *rawstr,
+                             const char *str,
+                             void *data);
+
+/*
+ * Logs accesses must be serialized though a mutex
+ */
+virMutex virLogMutex;
+
+void
+virLogLock(void)
+{
+    virMutexLock(&virLogMutex);
+}
+
+
+void
+virLogUnlock(void)
+{
+    virMutexUnlock(&virLogMutex);
+}
+
+
+static const char *
+virLogOutputString(virLogDestination ldest)
+{
+    switch (ldest) {
+    case VIR_LOG_TO_STDERR:
+        return "stderr";
+    case VIR_LOG_TO_SYSLOG:
+        return "syslog";
+    case VIR_LOG_TO_FILE:
+        return "file";
+    case VIR_LOG_TO_JOURNALD:
+        return "journald";
+    }
+    return "unknown";
+}
+
+
+static const char *
+virLogPriorityString(virLogPriority lvl)
+{
+    switch (lvl) {
+    case VIR_LOG_DEBUG:
+        return "debug";
+    case VIR_LOG_INFO:
+        return "info";
+    case VIR_LOG_WARN:
+        return "warning";
+    case VIR_LOG_ERROR:
+        return "error";
+    }
+    return "unknown";
+}
+
+
+static int
+virLogOnceInit(void)
+{
+    const char *pbm = NULL;
+
+    if (virMutexInit(&virLogMutex) < 0)
+        return -1;
+
+    virLogLock();
+    if (VIR_ALLOC_N(virLogBuffer, virLogSize + 1) < 0) {
+        /*
+         * The debug buffer is not a critical component, allow startup
+         * even in case of failure to allocate it in case of a
+         * configuration mistake.
+         */
+        virLogSize = 64 * 1024;
+        if (VIR_ALLOC_N(virLogBuffer, virLogSize + 1) < 0) {
+            pbm = "Failed to allocate debug buffer: deactivating debug log\n";
+            virLogSize = 0;
+        } else {
+            pbm = "Failed to allocate debug buffer: reduced to 64 kB\n";
+        }
+    }
+    virLogLen = 0;
+    virLogStart = 0;
+    virLogEnd = 0;
+    virLogDefaultPriority = VIR_LOG_DEFAULT;
+    virLogUnlock();
+    if (pbm)
+        VIR_WARN("%s", pbm);
+    return 0;
+}
+
+VIR_ONCE_GLOBAL_INIT(virLog)
+
+
+/**
+ * virLogSetBufferSize:
+ * @size: size of the buffer in kilobytes or <= 0 to deactivate
+ *
+ * Dynamically set the size or deactivate the logging buffer used to keep
+ * a trace of all recent debug output. Note that the content of the buffer
+ * is lost if it gets reallocated.
+ *
+ * Return -1 in case of failure or 0 in case of success
+ */
+int
+virLogSetBufferSize(int size)
+{
+    int ret = 0;
+    int oldsize;
+    char *oldLogBuffer;
+    const char *pbm = NULL;
+
+    if (size < 0)
+        size = 0;
+
+    if (virLogInitialize() < 0)
+        return -1;
+
+    if (size * 1024 == virLogSize)
+        return ret;
+
+    virLogLock();
+
+    oldsize = virLogSize;
+    oldLogBuffer = virLogBuffer;
+
+    if (INT_MAX / 1024 <= size) {
+        pbm = "Requested log size of %d kB too large\n";
+        ret = -1;
+        goto error;
+    }
+
+    virLogSize = size * 1024;
+    if (VIR_ALLOC_N(virLogBuffer, virLogSize + 1) < 0) {
+        pbm = "Failed to allocate debug buffer of %d kB\n";
+        virLogBuffer = oldLogBuffer;
+        virLogSize = oldsize;
+        ret = -1;
+        goto error;
+    }
+    VIR_FREE(oldLogBuffer);
+    virLogLen = 0;
+    virLogStart = 0;
+    virLogEnd = 0;
+
+error:
+    virLogUnlock();
+    if (pbm)
+        VIR_ERROR(pbm, size);
+    return ret;
+}
+
+
+/**
+ * virLogReset:
+ *
+ * Reset the logging module to its default initial state
+ *
+ * Returns 0 if successful, and -1 in case or error
+ */
+int
+virLogReset(void)
+{
+    if (virLogInitialize() < 0)
+        return -1;
+
+    virLogLock();
+    virLogResetFilters();
+    virLogResetOutputs();
+    virLogLen = 0;
+    virLogStart = 0;
+    virLogEnd = 0;
+    virLogDefaultPriority = VIR_LOG_DEFAULT;
+    virLogUnlock();
+    return 0;
+}
+
+
+/*
+ * Store a string in the ring buffer
+ */
+static void
+virLogStr(const char *str)
+{
+    int tmp;
+    int len;
+
+    if ((str == NULL) || (virLogBuffer == NULL) || (virLogSize <= 0))
+        return;
+    len = strlen(str);
+    if (len >= virLogSize)
+        return;
+
+    /*
+     * copy the data and reset the end, we cycle over the end of the buffer
+     */
+    if (virLogEnd + len >= virLogSize) {
+        tmp = virLogSize - virLogEnd;
+        memcpy(&virLogBuffer[virLogEnd], str, tmp);
+        memcpy(&virLogBuffer[0], &str[tmp], len - tmp);
+        virLogEnd = len - tmp;
+    } else {
+        memcpy(&virLogBuffer[virLogEnd], str, len);
+        virLogEnd += len;
+    }
+    virLogBuffer[virLogEnd] = 0;
+    /*
+     * Update the log length, and if full move the start index
+     */
+    virLogLen += len;
+    if (virLogLen > virLogSize) {
+        tmp = virLogLen - virLogSize;
+        virLogLen = virLogSize;
+        virLogStart += tmp;
+        if (virLogStart >= virLogSize)
+            virLogStart -= virLogSize;
+    }
+}
+
+
+static void
+virLogDumpAllFD(const char *msg, int len)
+{
+    int i, found = 0;
+
+    if (len <= 0)
+        len = strlen(msg);
+
+    for (i = 0; i < virLogNbOutputs;i++) {
+        if (virLogOutputs[i].f == virLogOutputToFd) {
+            int fd = (intptr_t) virLogOutputs[i].data;
+
+            if (fd >= 0) {
+                ignore_value(safewrite(fd, msg, len));
+                found = 1;
+            }
+        }
+    }
+    if (!found)
+        ignore_value(safewrite(STDERR_FILENO, msg, len));
+}
+
+
+/**
+ * virLogEmergencyDumpAll:
+ * @signum: the signal number
+ *
+ * Emergency function called, possibly from a signal handler.
+ * It need to output the debug ring buffer through the log
+ * output which are safe to use from a signal handler.
+ * In case none is found it is emitted to standard error.
+ */
+void
+virLogEmergencyDumpAll(int signum)
+{
+    int len;
+    int oldLogStart, oldLogLen;
+
+    switch (signum) {
+#ifdef SIGFPE
+        case SIGFPE:
+            virLogDumpAllFD("Caught signal Floating-point exception", -1);
+            break;
+#endif
+#ifdef SIGSEGV
+        case SIGSEGV:
+            virLogDumpAllFD("Caught Segmentation violation", -1);
+            break;
+#endif
+#ifdef SIGILL
+        case SIGILL:
+            virLogDumpAllFD("Caught illegal instruction", -1);
+            break;
+#endif
+#ifdef SIGABRT
+        case SIGABRT:
+            virLogDumpAllFD("Caught abort signal", -1);
+            break;
+#endif
+#ifdef SIGBUS
+        case SIGBUS:
+            virLogDumpAllFD("Caught bus error", -1);
+            break;
+#endif
+#ifdef SIGUSR2
+        case SIGUSR2:
+            virLogDumpAllFD("Caught User-defined signal 2", -1);
+            break;
+#endif
+        default:
+            virLogDumpAllFD("Caught unexpected signal", -1);
+            break;
+    }
+    if ((virLogBuffer == NULL) || (virLogSize <= 0)) {
+        virLogDumpAllFD(" internal log buffer deactivated\n", -1);
+        return;
+    }
+
+    virLogDumpAllFD(" dumping internal log buffer:\n", -1);
+    virLogDumpAllFD("\n\n    ====== start of log =====\n\n", -1);
+
+    /*
+     * Since we can't lock the buffer safely from a signal handler
+     * we mark it as empty in case of concurrent access, and proceed
+     * with the data, at worse we will output something a bit weird
+     * if another thread start logging messages at the same time.
+     * Note that virLogStr() uses virLogEnd for the computations and
+     * writes to the buffer and only then updates virLogLen and virLogStart
+     * so it's best to reset it first.
+     */
+    oldLogStart = virLogStart;
+    oldLogLen = virLogLen;
+    virLogEnd = 0;
+    virLogLen = 0;
+    virLogStart = 0;
+
+    while (oldLogLen > 0) {
+        if (oldLogStart + oldLogLen < virLogSize) {
+            virLogBuffer[oldLogStart + oldLogLen] = 0;
+            virLogDumpAllFD(&virLogBuffer[oldLogStart], oldLogLen);
+            oldLogStart += oldLogLen;
+            oldLogLen = 0;
+        } else {
+            len = virLogSize - oldLogStart;
+            virLogBuffer[virLogSize] = 0;
+            virLogDumpAllFD(&virLogBuffer[oldLogStart], len);
+            oldLogLen -= len;
+            oldLogStart = 0;
+        }
+    }
+    virLogDumpAllFD("\n\n     ====== end of log =====\n\n", -1);
+}
+
+
+/**
+ * virLogSetDefaultPriority:
+ * @priority: the default priority level
+ *
+ * Set the default priority level, i.e. any logged data of a priority
+ * equal or superior to this level will be logged, unless a specific rule
+ * was defined for the log category of the message.
+ *
+ * Returns 0 if successful, -1 in case of error.
+ */
+int
+virLogSetDefaultPriority(virLogPriority priority)
+{
+    if ((priority < VIR_LOG_DEBUG) || (priority > VIR_LOG_ERROR)) {
+        VIR_WARN("Ignoring invalid log level setting.");
+        return -1;
+    }
+    if (virLogInitialize() < 0)
+        return -1;
+
+    virLogDefaultPriority = priority;
+    return 0;
+}
+
+
+/**
+ * virLogResetFilters:
+ *
+ * Removes the set of logging filters defined.
+ *
+ * Returns the number of filters removed
+ */
+static int
+virLogResetFilters(void)
+{
+    int i;
+
+    for (i = 0; i < virLogNbFilters;i++)
+        VIR_FREE(virLogFilters[i].match);
+    VIR_FREE(virLogFilters);
+    virLogNbFilters = 0;
+    return i;
+}
+
+
+/**
+ * virLogDefineFilter:
+ * @match: the pattern to match
+ * @priority: the priority to give to messages matching the pattern
+ * @flags: extra flags, see virLogFilterFlags enum
+ *
+ * Defines a pattern used for log filtering, it allow to select or
+ * reject messages independently of the default priority.
+ * The filter defines a rules that will apply only to messages matching
+ * the pattern (currently if @match is a substring of the message category)
+ *
+ * Returns -1 in case of failure or the filter number if successful
+ */
+int
+virLogDefineFilter(const char *match,
+                   virLogPriority priority,
+                   unsigned int flags)
+{
+    int i;
+    char *mdup = NULL;
+
+    virCheckFlags(VIR_LOG_STACK_TRACE, -1);
+
+    if ((match == NULL) || (priority < VIR_LOG_DEBUG) ||
+        (priority > VIR_LOG_ERROR))
+        return -1;
+
+    virLogLock();
+    for (i = 0;i < virLogNbFilters;i++) {
+        if (STREQ(virLogFilters[i].match, match)) {
+            virLogFilters[i].priority = priority;
+            goto cleanup;
+        }
+    }
+
+    mdup = strdup(match);
+    if (mdup == NULL) {
+        i = -1;
+        goto cleanup;
+    }
+    i = virLogNbFilters;
+    if (VIR_REALLOC_N(virLogFilters, virLogNbFilters + 1)) {
+        i = -1;
+        VIR_FREE(mdup);
+        goto cleanup;
+    }
+    virLogFilters[i].match = mdup;
+    virLogFilters[i].priority = priority;
+    virLogFilters[i].flags = flags;
+    virLogNbFilters++;
+cleanup:
+    virLogUnlock();
+    return i;
+}
+
+
+/**
+ * virLogFiltersCheck:
+ * @input: the input string
+ *
+ * Check the input of the message against the existing filters. Currently
+ * the match is just a substring check of the category used as the input
+ * string, a more subtle approach could be used instead
+ *
+ * Returns 0 if not matched or the new priority if found.
+ */
+static int
+virLogFiltersCheck(const char *input,
+                   unsigned int *flags)
+{
+    int ret = 0;
+    int i;
+
+    virLogLock();
+    for (i = 0;i < virLogNbFilters;i++) {
+        if (strstr(input, virLogFilters[i].match)) {
+            ret = virLogFilters[i].priority;
+            *flags = virLogFilters[i].flags;
+            break;
+        }
+    }
+    virLogUnlock();
+    return ret;
+}
+
+
+/**
+ * virLogResetOutputs:
+ *
+ * Removes the set of logging output defined.
+ *
+ * Returns the number of output removed
+ */
+static int
+virLogResetOutputs(void)
+{
+    int i;
+
+    for (i = 0;i < virLogNbOutputs;i++) {
+        if (virLogOutputs[i].c != NULL)
+            virLogOutputs[i].c(virLogOutputs[i].data);
+        VIR_FREE(virLogOutputs[i].name);
+    }
+    VIR_FREE(virLogOutputs);
+    i = virLogNbOutputs;
+    virLogNbOutputs = 0;
+    return i;
+}
+
+
+/**
+ * virLogDefineOutput:
+ * @f: the function to call to output a message
+ * @c: the function to call to close the output (or NULL)
+ * @data: extra data passed as first arg to the function
+ * @priority: minimal priority for this filter, use 0 for none
+ * @dest: where to send output of this priority
+ * @name: optional name data associated with an output
+ * @flags: extra flag, currently unused
+ *
+ * Defines an output function for log messages. Each message once
+ * gone though filtering is emitted through each registered output.
+ *
+ * Returns -1 in case of failure or the output number if successful
+ */
+int
+virLogDefineOutput(virLogOutputFunc f,
+                   virLogCloseFunc c,
+                   void *data,
+                   virLogPriority priority,
+                   virLogDestination dest,
+                   const char *name,
+                   unsigned int flags)
+{
+    int ret = -1;
+    char *ndup = NULL;
+
+    virCheckFlags(0, -1);
+
+    if (f == NULL)
+        return -1;
+
+    if (dest == VIR_LOG_TO_SYSLOG || dest == VIR_LOG_TO_FILE) {
+        if (name == NULL)
+            return -1;
+        ndup = strdup(name);
+        if (ndup == NULL)
+            return -1;
+    }
+
+    virLogLock();
+    if (VIR_REALLOC_N(virLogOutputs, virLogNbOutputs + 1)) {
+        VIR_FREE(ndup);
+        goto cleanup;
+    }
+    ret = virLogNbOutputs++;
+    virLogOutputs[ret].logVersion = true;
+    virLogOutputs[ret].f = f;
+    virLogOutputs[ret].c = c;
+    virLogOutputs[ret].data = data;
+    virLogOutputs[ret].priority = priority;
+    virLogOutputs[ret].dest = dest;
+    virLogOutputs[ret].name = ndup;
+cleanup:
+    virLogUnlock();
+    return ret;
+}
+
+
+static int
+virLogFormatString(char **msg,
+                   int linenr,
+                   const char *funcname,
+                   virLogPriority priority,
+                   const char *str)
+{
+    int ret;
+
+    /*
+     * Be careful when changing the following log message formatting, we rely
+     * on it when stripping libvirt debug messages from qemu log files. So when
+     * changing this, you might also need to change the code there.
+     * virLogFormatString() function name is mentioned there so it's sufficient
+     * to just grep for it to find the right place.
+     */
+    if ((funcname != NULL)) {
+        ret = virAsprintf(msg, "%d: %s : %s:%d : %s\n",
+                          virThreadSelfID(), virLogPriorityString(priority),
+                          funcname, linenr, str);
+    } else {
+        ret = virAsprintf(msg, "%d: %s : %s\n",
+                          virThreadSelfID(), virLogPriorityString(priority),
+                          str);
+    }
+    return ret;
+}
+
+
+static int
+virLogVersionString(const char **rawmsg,
+                    char **msg)
+{
+#ifdef PACKAGER_VERSION
+# ifdef PACKAGER
+#  define LOG_VERSION_STRING \
+    "libvirt version: " VERSION ", package: " PACKAGER_VERSION " (" PACKAGER ")"
+# else
+#  define LOG_VERSION_STRING \
+    "libvirt version: " VERSION ", package: " PACKAGER_VERSION
+# endif
+#else
+# define LOG_VERSION_STRING  \
+    "libvirt version: " VERSION
+#endif
+
+    *rawmsg = LOG_VERSION_STRING;
+    return virLogFormatString(msg, 0, NULL, VIR_LOG_INFO, LOG_VERSION_STRING);
+}
+
+
+/**
+ * virLogMessage:
+ * @source: where is that message coming from
+ * @priority: the priority level
+ * @filename: file where the message was emitted
+ * @linenr: line where the message was emitted
+ * @funcname: the function emitting the (debug) message
+ * @metadata: NULL or metadata array, terminated by an item with NULL key
+ * @fmt: the string format
+ * @...: the arguments
+ *
+ * Call the libvirt logger with some information. Based on the configuration
+ * the message may be stored, sent to output or just discarded
+ */
+void
+virLogMessage(virLogSource source,
+              virLogPriority priority,
+              const char *filename,
+              int linenr,
+              const char *funcname,
+              virLogMetadataPtr metadata,
+              const char *fmt, ...)
+{
+    va_list ap;
+    va_start(ap, fmt);
+    virLogVMessage(source, priority,
+                   filename, linenr, funcname,
+                   metadata, fmt, ap);
+    va_end(ap);
+}
+
+
+/**
+ * virLogVMessage:
+ * @source: where is that message coming from
+ * @priority: the priority level
+ * @filename: file where the message was emitted
+ * @linenr: line where the message was emitted
+ * @funcname: the function emitting the (debug) message
+ * @metadata: NULL or metadata array, terminated by an item with NULL key
+ * @fmt: the string format
+ * @vargs: format args
+ *
+ * Call the libvirt logger with some information. Based on the configuration
+ * the message may be stored, sent to output or just discarded
+ */
+void
+virLogVMessage(virLogSource source,
+               virLogPriority priority,
+               const char *filename,
+               int linenr,
+               const char *funcname,
+               virLogMetadataPtr metadata,
+               const char *fmt,
+               va_list vargs)
+{
+    static bool logVersionStderr = true;
+    char *str = NULL;
+    char *msg = NULL;
+    char timestamp[VIR_TIME_STRING_BUFLEN];
+    int fprio, i, ret;
+    int saved_errno = errno;
+    int emit = 1;
+    unsigned int filterflags = 0;
+
+    if (virLogInitialize() < 0)
+        return;
+
+    if (fmt == NULL)
+        goto cleanup;
+
+    /*
+     * check against list of specific logging patterns
+     */
+    fprio = virLogFiltersCheck(filename, &filterflags);
+    if (fprio == 0) {
+        if (priority < virLogDefaultPriority)
+            emit = 0;
+    } else if (priority < fprio) {
+        emit = 0;
+    }
+
+    if ((emit == 0) && ((virLogBuffer == NULL) || (virLogSize <= 0)))
+        goto cleanup;
+
+    /*
+     * serialize the error message, add level and timestamp
+     */
+    if (virVasprintf(&str, fmt, vargs) < 0) {
+        goto cleanup;
+    }
+
+    ret = virLogFormatString(&msg, linenr, funcname, priority, str);
+    if (ret < 0)
+        goto cleanup;
+
+    if (virTimeStringNowRaw(timestamp) < 0)
+        timestamp[0] = '\0';
+
+    /*
+     * Log based on defaults, first store in the history buffer,
+     * then if emit push the message on the outputs defined, if none
+     * use stderr.
+     * NOTE: the locking is a single point of contention for multiple
+     *       threads, but avoid intermixing. Maybe set up locks per output
+     *       to improve paralellism.
+     */
+    virLogLock();
+    virLogStr(timestamp);
+    virLogStr(msg);
+    virLogUnlock();
+    if (emit == 0)
+        goto cleanup;
+
+    virLogLock();
+    for (i = 0; i < virLogNbOutputs; i++) {
+        if (priority >= virLogOutputs[i].priority) {
+            if (virLogOutputs[i].logVersion) {
+                const char *rawver;
+                char *ver = NULL;
+                if (virLogVersionString(&rawver, &ver) >= 0)
+                    virLogOutputs[i].f(VIR_LOG_FROM_FILE, VIR_LOG_INFO,
+                                       __FILE__, __LINE__, __func__,
+                                       timestamp, NULL, 0, rawver, ver,
+                                       virLogOutputs[i].data);
+                VIR_FREE(ver);
+                virLogOutputs[i].logVersion = false;
+            }
+            virLogOutputs[i].f(source, priority,
+                               filename, linenr, funcname,
+                               timestamp, metadata, filterflags,
+                               str, msg, virLogOutputs[i].data);
+        }
+    }
+    if ((virLogNbOutputs == 0) && (source != VIR_LOG_FROM_ERROR)) {
+        if (logVersionStderr) {
+            const char *rawver;
+            char *ver = NULL;
+            if (virLogVersionString(&rawver, &ver) >= 0)
+                virLogOutputToFd(VIR_LOG_FROM_FILE, VIR_LOG_INFO,
+                                 __FILE__, __LINE__, __func__,
+                                 timestamp, NULL, 0, rawver, ver,
+                                 (void *) STDERR_FILENO);
+            VIR_FREE(ver);
+            logVersionStderr = false;
+        }
+        virLogOutputToFd(source, priority,
+                         filename, linenr, funcname,
+                         timestamp, metadata, filterflags,
+                         str, msg, (void *) STDERR_FILENO);
+    }
+    virLogUnlock();
+
+cleanup:
+    VIR_FREE(str);
+    VIR_FREE(msg);
+    errno = saved_errno;
+}
+
+
+static void
+virLogStackTraceToFd(int fd)
+{
+    void *array[100];
+    int size;
+    static bool doneWarning = false;
+    const char *msg = "Stack trace not available on this platform\n";
+
+#define STRIP_DEPTH 3
+    size = backtrace(array, ARRAY_CARDINALITY(array));
+    if (size) {
+        backtrace_symbols_fd(array +  STRIP_DEPTH, size - STRIP_DEPTH, fd);
+        ignore_value(safewrite(fd, "\n", 1));
+    } else if (!doneWarning) {
+        ignore_value(safewrite(fd, msg, strlen(msg)));
+        doneWarning = true;
+    }
+#undef STRIP_DEPTH
+}
+
+static void
+virLogOutputToFd(virLogSource source ATTRIBUTE_UNUSED,
+                 virLogPriority priority ATTRIBUTE_UNUSED,
+                 const char *filename ATTRIBUTE_UNUSED,
+                 int linenr ATTRIBUTE_UNUSED,
+                 const char *funcname ATTRIBUTE_UNUSED,
+                 const char *timestamp,
+                 virLogMetadataPtr metadata ATTRIBUTE_UNUSED,
+                 unsigned int flags,
+                 const char *rawstr ATTRIBUTE_UNUSED,
+                 const char *str,
+                 void *data)
+{
+    int fd = (intptr_t) data;
+    char *msg;
+
+    if (fd < 0)
+        return;
+
+    if (virAsprintf(&msg, "%s: %s", timestamp, str) < 0)
+        return;
+
+    ignore_value(safewrite(fd, msg, strlen(msg)));
+    VIR_FREE(msg);
+
+    if (flags & VIR_LOG_STACK_TRACE)
+        virLogStackTraceToFd(fd);
+}
+
+
+static void
+virLogCloseFd(void *data)
+{
+    int fd = (intptr_t) data;
+
+    VIR_LOG_CLOSE(fd);
+}
+
+
+static int
+virLogAddOutputToStderr(virLogPriority priority)
+{
+    if (virLogDefineOutput(virLogOutputToFd, NULL, (void *)2L, priority,
+                           VIR_LOG_TO_STDERR, NULL, 0) < 0)
+        return -1;
+    return 0;
+}
+
+
+static int
+virLogAddOutputToFile(virLogPriority priority,
+                      const char *file)
+{
+    int fd;
+
+    fd = open(file, O_CREAT | O_APPEND | O_WRONLY, S_IRUSR | S_IWUSR);
+    if (fd < 0)
+        return -1;
+    if (virLogDefineOutput(virLogOutputToFd, virLogCloseFd,
+                           (void *)(intptr_t)fd,
+                           priority, VIR_LOG_TO_FILE, file, 0) < 0) {
+        VIR_FORCE_CLOSE(fd);
+        return -1;
+    }
+    return 0;
+}
+
+
+#if HAVE_SYSLOG_H
+static int
+virLogPrioritySyslog(virLogPriority priority)
+{
+    switch (priority) {
+    case VIR_LOG_DEBUG:
+        return LOG_DEBUG;
+    case VIR_LOG_INFO:
+        return LOG_INFO;
+    case VIR_LOG_WARN:
+        return LOG_WARNING;
+    case VIR_LOG_ERROR:
+        return LOG_ERR;
+    default:
+        return LOG_ERR;
+    }
+}
+
+
+static void
+virLogOutputToSyslog(virLogSource source ATTRIBUTE_UNUSED,
+                     virLogPriority priority,
+                     const char *filename ATTRIBUTE_UNUSED,
+                     int linenr ATTRIBUTE_UNUSED,
+                     const char *funcname ATTRIBUTE_UNUSED,
+                     const char *timestamp ATTRIBUTE_UNUSED,
+                     virLogMetadataPtr metadata ATTRIBUTE_UNUSED,
+                     unsigned int flags,
+                     const char *rawstr ATTRIBUTE_UNUSED,
+                     const char *str,
+                     void *data ATTRIBUTE_UNUSED)
+{
+    virCheckFlags(VIR_LOG_STACK_TRACE,);
+
+    syslog(virLogPrioritySyslog(priority), "%s", str);
+}
+
+static char *current_ident = NULL;
+
+
+static void
+virLogCloseSyslog(void *data ATTRIBUTE_UNUSED)
+{
+    closelog();
+    VIR_FREE(current_ident);
+}
+
+
+static int
+virLogAddOutputToSyslog(virLogPriority priority,
+                        const char *ident)
+{
+    /*
+     * ident needs to be kept around on Solaris
+     */
+    VIR_FREE(current_ident);
+    current_ident = strdup(ident);
+    if (current_ident == NULL)
+        return -1;
+
+    openlog(current_ident, 0, 0);
+    if (virLogDefineOutput(virLogOutputToSyslog, virLogCloseSyslog, NULL,
+                           priority, VIR_LOG_TO_SYSLOG, ident, 0) < 0) {
+        closelog();
+        VIR_FREE(current_ident);
+        return -1;
+    }
+    return 0;
+}
+
+
+# if USE_JOURNALD
+#  define IOVEC_SET(iov, data, size)            \
+    do {                                        \
+        struct iovec *_i = &(iov);              \
+        _i->iov_base = (void*)(data);           \
+        _i->iov_len = (size);                   \
+    } while (0)
+
+#  define IOVEC_SET_STRING(iov, str) IOVEC_SET(iov, str, strlen(str))
+
+/* Used for conversion of numbers to strings, and for length of binary data */
+#  define JOURNAL_BUF_SIZE (MAX(INT_BUFSIZE_BOUND(int), sizeof(uint64_t)))
+
+struct journalState
+{
+    struct iovec *iov, *iov_end;
+    char (*bufs)[JOURNAL_BUF_SIZE], (*bufs_end)[JOURNAL_BUF_SIZE];
+};
+
+static void
+journalAddString(struct journalState *state, const char *field,
+                 const char *value)
+{
+    static const char newline = '\n', equals = '=';
+
+    if (strchr(value, '\n') != NULL) {
+        uint64_t nstr;
+
+        /* If 'str' contains a newline, then we must
+         * encode the string length, since we can't
+         * rely on the newline for the field separator
+         */
+        if (state->iov_end - state->iov < 5 || state->bufs == state->bufs_end)
+            return; /* Silently drop */
+        nstr = htole64(strlen(value));
+        memcpy(state->bufs[0], &nstr, sizeof(nstr));
+
+        IOVEC_SET_STRING(state->iov[0], field);
+        IOVEC_SET(state->iov[1], &newline, sizeof(newline));
+        IOVEC_SET(state->iov[2], state->bufs[0], sizeof(nstr));
+        state->bufs++;
+        state->iov += 3;
+    } else {
+        if (state->iov_end - state->iov < 4)
+            return; /* Silently drop */
+        IOVEC_SET_STRING(state->iov[0], field);
+        IOVEC_SET(state->iov[1], (void *)&equals, sizeof(equals));
+        state->iov += 2;
+    }
+    IOVEC_SET_STRING(state->iov[0], value);
+    IOVEC_SET(state->iov[1], (void *)&newline, sizeof(newline));
+    state->iov += 2;
+}
+
+static void
+journalAddInt(struct journalState *state, const char *field, int value)
+{
+    static const char newline = '\n', equals = '=';
+
+    char *num;
+
+    if (state->iov_end - state->iov < 4 || state->bufs == state->bufs_end)
+        return; /* Silently drop */
+
+    num = virFormatIntDecimal(state->bufs[0], sizeof(state->bufs[0]), value);
+
+    IOVEC_SET_STRING(state->iov[0], field);
+    IOVEC_SET(state->iov[1], (void *)&equals, sizeof(equals));
+    IOVEC_SET_STRING(state->iov[2], num);
+    IOVEC_SET(state->iov[3], (void *)&newline, sizeof(newline));
+    state->bufs++;
+    state->iov += 4;
+}
+
+static int journalfd = -1;
+
+static void
+virLogOutputToJournald(virLogSource source,
+                       virLogPriority priority,
+                       const char *filename,
+                       int linenr,
+                       const char *funcname,
+                       const char *timestamp ATTRIBUTE_UNUSED,
+                       virLogMetadataPtr metadata ATTRIBUTE_UNUSED,
+                       unsigned int flags,
+                       const char *rawstr,
+                       const char *str ATTRIBUTE_UNUSED,
+                       void *data ATTRIBUTE_UNUSED)
+{
+    virCheckFlags(VIR_LOG_STACK_TRACE,);
+    int buffd = -1;
+    struct msghdr mh;
+    struct sockaddr_un sa;
+    union {
+        struct cmsghdr cmsghdr;
+        uint8_t buf[CMSG_SPACE(sizeof(int))];
+    } control;
+    struct cmsghdr *cmsg;
+    /* We use /dev/shm instead of /tmp here, since we want this to
+     * be a tmpfs, and one that is available from early boot on
+     * and where unprivileged users can create files. */
+    char path[] = "/dev/shm/journal.XXXXXX";
+
+#  define NUM_FIELDS 6
+    struct iovec iov[NUM_FIELDS * 5];
+    char iov_bufs[NUM_FIELDS][JOURNAL_BUF_SIZE];
+    struct journalState state;
+
+    state.iov = iov;
+    state.iov_end = iov + ARRAY_CARDINALITY(iov);
+    state.bufs = iov_bufs;
+    state.bufs_end = iov_bufs + ARRAY_CARDINALITY(iov_bufs);
+
+    journalAddString(&state ,"MESSAGE", rawstr);
+    journalAddInt(&state, "PRIORITY", priority);
+    journalAddString(&state, "LIBVIRT_SOURCE",
+                     virLogSourceTypeToString(source));
+    journalAddString(&state, "CODE_FILE", filename);
+    journalAddInt(&state, "CODE_LINE", linenr);
+    journalAddString(&state, "CODE_FUNC", funcname);
+
+    memset(&sa, 0, sizeof(sa));
+    sa.sun_family = AF_UNIX;
+    if (!virStrcpy(sa.sun_path, "/run/systemd/journal/socket", sizeof(sa.sun_path)))
+        return;
+
+    memset(&mh, 0, sizeof(mh));
+    mh.msg_name = &sa;
+    mh.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(sa.sun_path);
+    mh.msg_iov = iov;
+    mh.msg_iovlen = state.iov - iov;
+
+    if (sendmsg(journalfd, &mh, MSG_NOSIGNAL) >= 0)
+        return;
+
+    if (errno != EMSGSIZE && errno != ENOBUFS)
+        return;
+
+    /* Message was too large, so dump to temporary file
+     * and pass an FD to the journal
+     */
+
+    /* NB: mkostemp is not declared async signal safe by
+     * POSIX, but this is Linux only code and the GLibc
+     * impl is safe enough, only using open() and inline
+     * asm to read a timestamp (falling back to gettimeofday
+     * on some arches
+     */
+    if ((buffd = mkostemp(path, O_CLOEXEC|O_RDWR)) < 0)
+        return;
+
+    if (unlink(path) < 0)
+        goto cleanup;
+
+    if (writev(buffd, iov, state.iov - iov) < 0)
+        goto cleanup;
+
+    mh.msg_iov = NULL;
+    mh.msg_iovlen = 0;
+
+    memset(&control, 0, sizeof(control));
+    mh.msg_control = &control;
+    mh.msg_controllen = sizeof(control);
+
+    cmsg = CMSG_FIRSTHDR(&mh);
+    cmsg->cmsg_level = SOL_SOCKET;
+    cmsg->cmsg_type = SCM_RIGHTS;
+    cmsg->cmsg_len = CMSG_LEN(sizeof(int));
+    memcpy(CMSG_DATA(cmsg), &buffd, sizeof(int));
+
+    mh.msg_controllen = cmsg->cmsg_len;
+
+    sendmsg(journalfd, &mh, MSG_NOSIGNAL);
+
+cleanup:
+    VIR_LOG_CLOSE(buffd);
+}
+
+
+static void virLogCloseJournald(void *data ATTRIBUTE_UNUSED)
+{
+    VIR_LOG_CLOSE(journalfd);
+}
+
+
+static int virLogAddOutputToJournald(int priority)
+{
+    if ((journalfd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0)
+        return -1;
+    if (virSetInherit(journalfd, false) < 0) {
+        VIR_LOG_CLOSE(journalfd);
+        return -1;
+    }
+    if (virLogDefineOutput(virLogOutputToJournald, virLogCloseJournald, NULL,
+                           priority, VIR_LOG_TO_JOURNALD, NULL, 0) < 0) {
+        return -1;
+    }
+    return 0;
+}
+# endif /* USE_JOURNALD */
+#endif /* HAVE_SYSLOG_H */
+
+#define IS_SPACE(cur)                                                   \
+    ((*cur == ' ') || (*cur == '\t') || (*cur == '\n') ||               \
+     (*cur == '\r') || (*cur == '\\'))
+
+
+/**
+ * virLogParseOutputs:
+ * @outputs: string defining a (set of) output(s)
+ *
+ * The format for an output can be:
+ *    x:stderr
+ *       output goes to stderr
+ *    x:syslog:name
+ *       use syslog for the output and use the given name as the ident
+ *    x:file:file_path
+ *       output to a file, with the given filepath
+ * In all case the x prefix is the minimal level, acting as a filter
+ *    0: everything
+ *    1: DEBUG
+ *    2: INFO
+ *    3: WARNING
+ *    4: ERROR
+ *
+ * Multiple output can be defined in a single @output, they just need to be
+ * separated by spaces.
+ *
+ * Returns the number of output parsed and installed or -1 in case of error
+ */
+int
+virLogParseOutputs(const char *outputs)
+{
+    const char *cur = outputs, *str;
+    char *name;
+    char *abspath;
+    virLogPriority prio;
+    int ret = -1;
+    int count = 0;
+
+    if (cur == NULL)
+        return -1;
+
+    VIR_DEBUG("outputs=%s", outputs);
+
+    virSkipSpaces(&cur);
+    while (*cur != 0) {
+        prio= virParseNumber(&cur);
+        if ((prio < VIR_LOG_DEBUG) || (prio > VIR_LOG_ERROR))
+            goto cleanup;
+        if (*cur != ':')
+            goto cleanup;
+        cur++;
+        if (STREQLEN(cur, "stderr", 6)) {
+            cur += 6;
+            if (virLogAddOutputToStderr(prio) == 0)
+                count++;
+        } else if (STREQLEN(cur, "syslog", 6)) {
+            cur += 6;
+            if (*cur != ':')
+                goto cleanup;
+            cur++;
+            str = cur;
+            while ((*cur != 0) && (!IS_SPACE(cur)))
+                cur++;
+            if (str == cur)
+                goto cleanup;
+#if HAVE_SYSLOG_H
+            name = strndup(str, cur - str);
+            if (name == NULL)
+                goto cleanup;
+            if (virLogAddOutputToSyslog(prio, name) == 0)
+                count++;
+            VIR_FREE(name);
+#endif /* HAVE_SYSLOG_H */
+        } else if (STREQLEN(cur, "file", 4)) {
+            cur += 4;
+            if (*cur != ':')
+                goto cleanup;
+            cur++;
+            str = cur;
+            while ((*cur != 0) && (!IS_SPACE(cur)))
+                cur++;
+            if (str == cur)
+                goto cleanup;
+            name = strndup(str, cur - str);
+            if (name == NULL)
+                goto cleanup;
+            if (virFileAbsPath(name, &abspath) < 0) {
+                VIR_FREE(name);
+                return -1; /* skip warning here because setting was fine */
+            }
+            if (virLogAddOutputToFile(prio, abspath) == 0)
+                count++;
+            VIR_FREE(name);
+            VIR_FREE(abspath);
+        } else if (STREQLEN(cur, "journald", 8)) {
+            cur += 8;
+#if USE_JOURNALD
+            if (virLogAddOutputToJournald(prio) == 0)
+                count++;
+#endif /* USE_JOURNALD */
+        } else {
+            goto cleanup;
+        }
+        virSkipSpaces(&cur);
+    }
+    ret = count;
+cleanup:
+    if (ret == -1)
+        VIR_WARN("Ignoring invalid log output setting.");
+    return ret;
+}
+
+
+/**
+ * virLogParseFilters:
+ * @filters: string defining a (set of) filter(s)
+ *
+ * The format for a filter is:
+ *    x:name
+ *       where name is a match string
+ * the x prefix is the minimal level where the messages should be logged
+ *    1: DEBUG
+ *    2: INFO
+ *    3: WARNING
+ *    4: ERROR
+ *
+ * Multiple filter can be defined in a single @filters, they just need to be
+ * separated by spaces.
+ *
+ * Returns the number of filter parsed and installed or -1 in case of error
+ */
+int
+virLogParseFilters(const char *filters)
+{
+    const char *cur = filters, *str;
+    char *name;
+    virLogPriority prio;
+    int ret = -1;
+    int count = 0;
+
+    if (cur == NULL)
+        return -1;
+
+    virSkipSpaces(&cur);
+    while (*cur != 0) {
+        unsigned int flags = 0;
+        prio= virParseNumber(&cur);
+        if ((prio < VIR_LOG_DEBUG) || (prio > VIR_LOG_ERROR))
+            goto cleanup;
+        if (*cur != ':')
+            goto cleanup;
+        cur++;
+        if (*cur == '+') {
+            flags |= VIR_LOG_STACK_TRACE;
+            cur++;
+        }
+        str = cur;
+        while ((*cur != 0) && (!IS_SPACE(cur)))
+            cur++;
+        if (str == cur)
+            goto cleanup;
+        name = strndup(str, cur - str);
+        if (name == NULL)
+            goto cleanup;
+        if (virLogDefineFilter(name, prio, flags) >= 0)
+            count++;
+        VIR_FREE(name);
+        virSkipSpaces(&cur);
+    }
+    ret = count;
+cleanup:
+    if (ret == -1)
+        VIR_WARN("Ignoring invalid log filter setting.");
+    return ret;
+}
+
+
+/**
+ * virLogGetDefaultPriority:
+ *
+ * Returns the current logging priority level.
+ */
+virLogPriority
+virLogGetDefaultPriority(void)
+{
+    return virLogDefaultPriority;
+}
+
+
+/**
+ * virLogGetFilters:
+ *
+ * Returns a string listing the current filters, in the format originally
+ * specified in the config file or environment. Caller must free the
+ * result.
+ */
+char *
+virLogGetFilters(void)
+{
+    int i;
+    virBuffer filterbuf = VIR_BUFFER_INITIALIZER;
+
+    virLogLock();
+    for (i = 0; i < virLogNbFilters; i++) {
+        const char *sep = ":";
+        if (virLogFilters[i].flags & VIR_LOG_STACK_TRACE)
+            sep = ":+";
+        virBufferAsprintf(&filterbuf, "%d%s%s ",
+                          virLogFilters[i].priority,
+                          sep,
+                          virLogFilters[i].match);
+    }
+    virLogUnlock();
+
+    if (virBufferError(&filterbuf)) {
+        virBufferFreeAndReset(&filterbuf);
+        return NULL;
+    }
+
+    return virBufferContentAndReset(&filterbuf);
+}
+
+
+/**
+ * virLogGetOutputs:
+ *
+ * Returns a string listing the current outputs, in the format originally
+ * specified in the config file or environment. Caller must free the
+ * result.
+ */
+char *
+virLogGetOutputs(void)
+{
+    int i;
+    virBuffer outputbuf = VIR_BUFFER_INITIALIZER;
+
+    virLogLock();
+    for (i = 0; i < virLogNbOutputs; i++) {
+        virLogDestination dest = virLogOutputs[i].dest;
+        if (i)
+            virBufferAsprintf(&outputbuf, " ");
+        switch (dest) {
+            case VIR_LOG_TO_SYSLOG:
+            case VIR_LOG_TO_FILE:
+                virBufferAsprintf(&outputbuf, "%d:%s:%s",
+                                  virLogOutputs[i].priority,
+                                  virLogOutputString(dest),
+                                  virLogOutputs[i].name);
+                break;
+            default:
+                virBufferAsprintf(&outputbuf, "%d:%s",
+                                  virLogOutputs[i].priority,
+                                  virLogOutputString(dest));
+        }
+    }
+    virLogUnlock();
+
+    if (virBufferError(&outputbuf)) {
+        virBufferFreeAndReset(&outputbuf);
+        return NULL;
+    }
+
+    return virBufferContentAndReset(&outputbuf);
+}
+
+
+/**
+ * virLogGetNbFilters:
+ *
+ * Returns the current number of defined log filters.
+ */
+int
+virLogGetNbFilters(void)
+{
+    return virLogNbFilters;
+}
+
+
+/**
+ * virLogGetNbOutputs:
+ *
+ * Returns the current number of defined log outputs.
+ */
+int
+virLogGetNbOutputs(void)
+{
+    return virLogNbOutputs;
+}
+
+
+/**
+ * virLogParseDefaultPriority:
+ * @priority: string defining the desired logging level
+ *
+ * Parses and sets the default log priority level. It can take a string or
+ * number corresponding to the following levels:
+ *    1: DEBUG
+ *    2: INFO
+ *    3: WARNING
+ *    4: ERROR
+ *
+ * Returns the parsed log level or -1 on error.
+ */
+int
+virLogParseDefaultPriority(const char *priority)
+{
+    int ret = -1;
+
+    if (STREQ(priority, "1") || STREQ(priority, "debug"))
+        ret = virLogSetDefaultPriority(VIR_LOG_DEBUG);
+    else if (STREQ(priority, "2") || STREQ(priority, "info"))
+        ret = virLogSetDefaultPriority(VIR_LOG_INFO);
+    else if (STREQ(priority, "3") || STREQ(priority, "warning"))
+        ret = virLogSetDefaultPriority(VIR_LOG_WARN);
+    else if (STREQ(priority, "4") || STREQ(priority, "error"))
+        ret = virLogSetDefaultPriority(VIR_LOG_ERROR);
+    else
+        VIR_WARN("Ignoring invalid log level setting");
+
+    return ret;
+}
+
+
+/**
+ * virLogSetFromEnv:
+ *
+ * Sets virLogDefaultPriority, virLogFilters and virLogOutputs based on
+ * environment variables.
+ */
+void
+virLogSetFromEnv(void)
+{
+    char *debugEnv;
+
+    debugEnv = getenv("LIBVIRT_DEBUG");
+    if (debugEnv && *debugEnv)
+        virLogParseDefaultPriority(debugEnv);
+    debugEnv = getenv("LIBVIRT_LOG_FILTERS");
+    if (debugEnv && *debugEnv)
+        virLogParseFilters(debugEnv);
+    debugEnv = getenv("LIBVIRT_LOG_OUTPUTS");
+    if (debugEnv && *debugEnv)
+        virLogParseOutputs(debugEnv);
+}
diff --git a/src/util/virlog.h b/src/util/virlog.h
new file mode 100644
index 0000000..028b791
--- /dev/null
+++ b/src/util/virlog.h
@@ -0,0 +1,191 @@
+/*
+ * logging.h: internal logging and debugging
+ *
+ * Copyright (C) 2006-2008, 2011-2012 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __VIRTLOG_H_
+# define __VIRTLOG_H_
+
+# include "internal.h"
+# include "virbuffer.h"
+
+/*
+ * To be made public
+ */
+typedef enum {
+    VIR_LOG_DEBUG = 1,
+    VIR_LOG_INFO,
+    VIR_LOG_WARN,
+    VIR_LOG_ERROR,
+} virLogPriority;
+
+# define VIR_LOG_DEFAULT VIR_LOG_WARN
+
+typedef enum {
+    VIR_LOG_TO_STDERR = 1,
+    VIR_LOG_TO_SYSLOG,
+    VIR_LOG_TO_FILE,
+    VIR_LOG_TO_JOURNALD,
+} virLogDestination;
+
+typedef enum {
+    VIR_LOG_FROM_FILE,
+    VIR_LOG_FROM_ERROR,
+    VIR_LOG_FROM_AUDIT,
+    VIR_LOG_FROM_TRACE,
+    VIR_LOG_FROM_LIBRARY,
+
+    VIR_LOG_FROM_LAST,
+} virLogSource;
+
+/*
+ * If configured with --enable-debug=yes then library calls
+ * are printed to stderr for debugging or to an appropriate channel
+ * defined at runtime from the libvirt daemon configuration file
+ */
+# ifdef ENABLE_DEBUG
+#  define VIR_DEBUG_INT(src, filename, linenr, funcname, ...)           \
+    virLogMessage(src, VIR_LOG_DEBUG, filename, linenr, funcname, NULL, __VA_ARGS__)
+# else
+/**
+ * virLogEatParams:
+ *
+ * Do nothing but eat parameters.
+ */
+static inline void virLogEatParams(virLogSource unused, ...)
+{
+    /* Silence gcc */
+    unused = unused;
+}
+#  define VIR_DEBUG_INT(src, filename, linenr, funcname, ...)           \
+    virLogEatParams(src, filename, linenr, funcname, __VA_ARGS__)
+# endif /* !ENABLE_DEBUG */
+
+# define VIR_INFO_INT(src, filename, linenr, funcname, ...)             \
+    virLogMessage(src, VIR_LOG_INFO, filename, linenr, funcname, NULL, __VA_ARGS__)
+# define VIR_WARN_INT(src, filename, linenr, funcname, ...)             \
+    virLogMessage(src, VIR_LOG_WARN, filename, linenr, funcname, NULL, __VA_ARGS__)
+# define VIR_ERROR_INT(src, filename, linenr, funcname, ...)            \
+    virLogMessage(src, VIR_LOG_ERROR, filename, linenr, funcname, NULL, __VA_ARGS__)
+
+# define VIR_DEBUG(...)                                                 \
+    VIR_DEBUG_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
+# define VIR_INFO(...)                                                  \
+    VIR_INFO_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
+# define VIR_WARN(...)                                                  \
+    VIR_WARN_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
+# define VIR_ERROR(...)                                                 \
+    VIR_ERROR_INT(VIR_LOG_FROM_FILE, __FILE__, __LINE__, __func__, __VA_ARGS__)
+
+
+struct _virLogMetadata {
+    const char *key;
+    const char *s;              /* String value, or NULL to use "i" */
+    int i;
+};
+
+typedef struct _virLogMetadata virLogMetadata;
+typedef struct _virLogMetadata *virLogMetadataPtr;
+
+/**
+ * virLogOutputFunc:
+ * @src: the src for the message
+ * @priority: the priority for the message
+ * @filename: file where the message was emitted
+ * @linenr: line where the message was emitted
+ * @funcname: the function emitting the message
+ * @timestamp: zero terminated string with timestamp of the message
+ * @metadata: NULL or metadata array, terminated by an item with NULL key
+ * @flags: flags associated with the message
+ * @rawstr: the unformatted message to log, zero terminated
+ * @str: the message to log, preformatted and zero terminated
+ * @data: extra output logging data
+ *
+ * Callback function used to output messages
+ */
+typedef void (*virLogOutputFunc) (virLogSource src,
+                                  virLogPriority priority,
+                                  const char *filename,
+                                  int linenr,
+                                  const char *funcname,
+                                  const char *timestamp,
+                                  virLogMetadataPtr metadata,
+                                  unsigned int flags,
+                                  const char *rawstr,
+                                  const char *str,
+                                  void *data);
+
+/**
+ * virLogCloseFunc:
+ * @data: extra output logging data
+ *
+ * Callback function used to close a log output
+ */
+typedef void (*virLogCloseFunc) (void *data);
+
+typedef enum {
+    VIR_LOG_STACK_TRACE = (1 << 0),
+} virLogFlags;
+
+extern int virLogGetNbFilters(void);
+extern int virLogGetNbOutputs(void);
+extern char *virLogGetFilters(void);
+extern char *virLogGetOutputs(void);
+extern virLogPriority virLogGetDefaultPriority(void);
+extern int virLogSetDefaultPriority(virLogPriority priority);
+extern void virLogSetFromEnv(void);
+extern int virLogDefineFilter(const char *match,
+                              virLogPriority priority,
+                              unsigned int flags);
+extern int virLogDefineOutput(virLogOutputFunc f,
+                              virLogCloseFunc c,
+                              void *data,
+                              virLogPriority priority,
+                              virLogDestination dest,
+                              const char *name,
+                              unsigned int flags);
+
+/*
+ * Internal logging API
+ */
+
+extern void virLogLock(void);
+extern void virLogUnlock(void);
+extern int virLogReset(void);
+extern int virLogParseDefaultPriority(const char *priority);
+extern int virLogParseFilters(const char *filters);
+extern int virLogParseOutputs(const char *output);
+extern void virLogMessage(virLogSource src,
+                          virLogPriority priority,
+                          const char *filename,
+                          int linenr,
+                          const char *funcname,
+                          virLogMetadataPtr metadata,
+                          const char *fmt, ...) ATTRIBUTE_FMT_PRINTF(7, 8);
+extern void virLogVMessage(virLogSource src,
+                           virLogPriority priority,
+                           const char *filename,
+                           int linenr,
+                           const char *funcname,
+                           virLogMetadataPtr metadata,
+                           const char *fmt,
+                           va_list vargs) ATTRIBUTE_FMT_PRINTF(7, 0);
+extern int virLogSetBufferSize(int size);
+extern void virLogEmergencyDumpAll(int signum);
+#endif
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index e98a2ca..a1d1c12 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -29,7 +29,7 @@
 #include "vircommand.h"
 #include "memory.h"
 #include "pci.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include <sys/ioctl.h>
 #include <net/if.h>
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 657c484..8d2574c 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -57,7 +57,7 @@ VIR_ENUM_IMPL(virNetDevMacVLanMode, VIR_NETDEV_MACVLAN_MODE_LAST,
 # endif
 
 # include "memory.h"
-# include "logging.h"
+# include "virlog.h"
 # include "uuid.h"
 # include "virfile.h"
 # include "virnetlink.h"
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index 0eadd6c..644e9a4 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -31,7 +31,7 @@
 #include "virfile.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 
 #include <sys/ioctl.h>
diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
index 3261337..630b7c9 100644
--- a/src/util/virnetdevveth.c
+++ b/src/util/virnetdevveth.c
@@ -27,7 +27,7 @@
 
 #include "virnetdevveth.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "vircommand.h"
 #include "virterror_internal.h"
 
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index ac7aa5f..834b9b9 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -53,7 +53,7 @@ VIR_ENUM_IMPL(virNetDevVPortProfileOp, VIR_NETDEV_VPORT_PROFILE_OP_LAST,
 
 # include "virnetlink.h"
 # include "virfile.h"
-# include "logging.h"
+# include "virlog.h"
 # include "virnetdev.h"
 
 # define MICROSEC_PER_SEC       (1000 * 1000)
diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 8a8bfae..830e9b9 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -36,7 +36,7 @@
 #include <sys/socket.h>
 
 #include "virnetlink.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "threads.h"
 #include "virmacaddr.h"
diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index a34ca6a..e37a2d6 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -27,7 +27,7 @@
 #include "datatypes.h"
 
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virobject.c b/src/util/virobject.c
index 101507f..aa80cab 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -26,7 +26,7 @@
 #include "memory.h"
 #include "viratomic.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 90a79c5..6ec9760 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -32,7 +32,7 @@
 #include "memory.h"
 #include "util.h"
 #include "intprops.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "c-ctype.h"
 #include "areadlink.h"
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index f8a8a49..3c0ed8a 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -29,7 +29,7 @@
 #include "virprocess.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virrandom.c b/src/util/virrandom.c
index 002f655..c24bf3b 100644
--- a/src/util/virrandom.c
+++ b/src/util/virrandom.c
@@ -31,7 +31,7 @@
 #include "count-one-bits.h"
 #include "util.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 1142c40..6e3301b 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -29,7 +29,7 @@
 
 #include "virterror_internal.h"
 #include "datatypes.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "threads.h"
 #include "util.h"
diff --git a/src/util/virusb.c b/src/util/virusb.c
index b9c81ed..ebc1af5 100644
--- a/src/util/virusb.c
+++ b/src/util/virusb.c
@@ -32,7 +32,7 @@
 #include <unistd.h>
 
 #include "virusb.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 #include "util.h"
 #include "virterror_internal.h"
diff --git a/src/vbox/vbox_MSCOMGlue.c b/src/vbox/vbox_MSCOMGlue.c
index 9ddc89c..3194b7c 100644
--- a/src/vbox/vbox_MSCOMGlue.c
+++ b/src/vbox/vbox_MSCOMGlue.c
@@ -32,7 +32,7 @@
 #include "internal.h"
 #include "memory.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "vbox_MSCOMGlue.h"
 
diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index 63470ae..5f70283 100644
--- a/src/vbox/vbox_XPCOMCGlue.c
+++ b/src/vbox/vbox_XPCOMCGlue.c
@@ -39,7 +39,7 @@
 #include "internal.h"
 #include "memory.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 
 #define VIR_FROM_THIS VIR_FROM_VBOX
diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index 56726ed..cd29e19 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -34,7 +34,7 @@
 #include "internal.h"
 
 #include "datatypes.h"
-#include "logging.h"
+#include "virlog.h"
 #include "vbox_driver.h"
 #include "vbox_glue.h"
 #include "virterror_internal.h"
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index e0f9b6f..847af35 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -52,7 +52,7 @@
 #include "uuid.h"
 #include "memory.h"
 #include "nodeinfo.h"
-#include "logging.h"
+#include "virlog.h"
 #include "vbox_driver.h"
 #include "configmake.h"
 #include "virfile.h"
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 0d34453..e74e9ed 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -29,7 +29,7 @@
 #include "virterror_internal.h"
 #include "virconf.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "vmx.h"
 #include "viruri.h"
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index d9174b6..c281c00 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -40,7 +40,7 @@
 #include <xen/dom0_ops.h>
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "xen_driver.h"
 
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 1aa2b73..b094313 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -64,7 +64,7 @@
 #include <xen/sched.h>
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "driver.h"
 #include "util.h"
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index bcafdd0..073663f 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -36,7 +36,7 @@
 #include "domain_conf.h"
 #include "xen_inotify.h"
 #include "xend_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "virfile.h"
 
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 9407e95..0364f84 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -30,7 +30,7 @@
 #include <errno.h>
 
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "datatypes.h"
 #include "xend_internal.h"
 #include "driver.h"
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 2cd4b95..fc7b581 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -47,7 +47,7 @@
 #include "uuid.h"
 #include "util.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "count-one-bits.h"
 
 #define VIR_FROM_THIS VIR_FROM_XENXM
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index 8a0af62..4cc82d8 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -45,7 +45,7 @@
 #include "datatypes.h"
 #include "driver.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "uuid.h"
 #include "xen_driver.h"
 #include "xs_internal.h"
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index dbdb22d..6f51100 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -33,7 +33,7 @@
 #include "uuid.h"
 #include "memory.h"
 #include "virbuffer.h"
-#include "logging.h"
+#include "virlog.h"
 #include "viruri.h"
 #include "xenapi_driver_private.h"
 #include "xenapi_utils.h"
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index ed0c9e1..2aa384d 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -32,7 +32,7 @@
 #include "memory.h"
 #include "verify.h"
 #include "uuid.h"
-#include "logging.h"
+#include "virlog.h"
 #include "count-one-bits.h"
 #include "xenxs_private.h"
 #include "xen_sxpr.h"
diff --git a/tests/eventtest.c b/tests/eventtest.c
index bc8d443..cd36a2d 100644
--- a/tests/eventtest.c
+++ b/tests/eventtest.c
@@ -29,7 +29,7 @@
 #include "testutils.h"
 #include "internal.h"
 #include "threads.h"
-#include "logging.h"
+#include "virlog.h"
 #include "util.h"
 #include "vireventpoll.h"
 
diff --git a/tests/libvirtdconftest.c b/tests/libvirtdconftest.c
index c2b02a6..0365ade 100644
--- a/tests/libvirtdconftest.c
+++ b/tests/libvirtdconftest.c
@@ -27,7 +27,7 @@
 #include "util.h"
 #include "c-ctype.h"
 #include "virterror_internal.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virconf.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index b55d867..e4194de 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -31,7 +31,7 @@
 #include "rpc/virnetsocket.h"
 #include "memory.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c
index 8bcf3a1..c021480 100644
--- a/tests/securityselinuxtest.c
+++ b/tests/securityselinuxtest.c
@@ -32,7 +32,7 @@
 #include "testutils.h"
 #include "memory.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virterror_internal.h"
 #include "security/security_manager.h"
 
diff --git a/tests/sockettest.c b/tests/sockettest.c
index 2f85307..c6a175f 100644
--- a/tests/sockettest.c
+++ b/tests/sockettest.c
@@ -27,7 +27,7 @@
 
 #include "virsocketaddr.h"
 #include "testutils.h"
-#include "logging.h"
+#include "virlog.h"
 #include "memory.h"
 
 static void testQuietError(void *userData ATTRIBUTE_UNUSED,
diff --git a/tests/testutils.c b/tests/testutils.c
index 1315cb5..96e24d4 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -44,7 +44,7 @@
 #include "threads.h"
 #include "virterror_internal.h"
 #include "virbuffer.h"
-#include "logging.h"
+#include "virlog.h"
 #include "vircommand.h"
 #include "virrandom.h"
 #include "dirname.h"
diff --git a/tests/virauthconfigtest.c b/tests/virauthconfigtest.c
index 4d37af6..74cc187 100644
--- a/tests/virauthconfigtest.c
+++ b/tests/virauthconfigtest.c
@@ -27,7 +27,7 @@
 #include "util.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include "virauthconfig.h"
 
diff --git a/tests/virdrivermoduletest.c b/tests/virdrivermoduletest.c
index 53a772e..440ee8e 100644
--- a/tests/virdrivermoduletest.c
+++ b/tests/virdrivermoduletest.c
@@ -24,7 +24,7 @@
 #include "util.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "driver.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/tests/virhashtest.c b/tests/virhashtest.c
index 721e877..7de16d0 100644
--- a/tests/virhashtest.c
+++ b/tests/virhashtest.c
@@ -11,7 +11,7 @@
 #include "testutils.h"
 #include "memory.h"
 #include "util.h"
-#include "logging.h"
+#include "virlog.h"
 
 
 #define testError(...)                                          \
diff --git a/tests/virkeyfiletest.c b/tests/virkeyfiletest.c
index 3667c8c..c6aca86 100644
--- a/tests/virkeyfiletest.c
+++ b/tests/virkeyfiletest.c
@@ -27,7 +27,7 @@
 #include "util.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include "virkeyfile.h"
 
diff --git a/tests/virlockspacetest.c b/tests/virlockspacetest.c
index ee58f95..c95f5d8 100644
--- a/tests/virlockspacetest.c
+++ b/tests/virlockspacetest.c
@@ -28,7 +28,7 @@
 #include "util.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include "virlockspace.h"
 
diff --git a/tests/virnetmessagetest.c b/tests/virnetmessagetest.c
index eff8ea7..c20f5e6 100644
--- a/tests/virnetmessagetest.c
+++ b/tests/virnetmessagetest.c
@@ -27,7 +27,7 @@
 #include "util.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include "rpc/virnetmessage.h"
 
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index e31f19a..ba281e9 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -31,7 +31,7 @@
 #include "util.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 
 #include "rpc/virnetsocket.h"
diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c
index d421feb..0236659 100644
--- a/tests/virnettlscontexttest.c
+++ b/tests/virnettlscontexttest.c
@@ -30,7 +30,7 @@
 #include "util.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 #include "virfile.h"
 #include "vircommand.h"
 #include "virsocketaddr.h"
diff --git a/tests/virstringtest.c b/tests/virstringtest.c
index 7e726c6..27e490f 100644
--- a/tests/virstringtest.c
+++ b/tests/virstringtest.c
@@ -26,7 +26,7 @@
 #include "util.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include "virstring.h"
 
diff --git a/tests/virtimetest.c b/tests/virtimetest.c
index dca4efb..c8e9a2e 100644
--- a/tests/virtimetest.c
+++ b/tests/virtimetest.c
@@ -27,7 +27,7 @@
 #include "util.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include "virtime.h"
 
diff --git a/tests/viruritest.c b/tests/viruritest.c
index 430bcb6..46964b3 100644
--- a/tests/viruritest.c
+++ b/tests/viruritest.c
@@ -27,7 +27,7 @@
 #include "util.h"
 #include "virterror_internal.h"
 #include "memory.h"
-#include "logging.h"
+#include "virlog.h"
 
 #include "viruri.h"
 
diff --git a/tools/console.c b/tools/console.c
index 40de8eb..dbdaab7 100644
--- a/tools/console.c
+++ b/tools/console.c
@@ -38,7 +38,7 @@
 
 # include "internal.h"
 # include "console.h"
-# include "logging.h"
+# include "virlog.h"
 # include "util.h"
 # include "virfile.h"
 # include "memory.h"
-- 
1.7.11.7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]