qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu.py: Call logging.basicConfig() automatically
@ 2017-09-21 16:22 Eduardo Habkost
  2017-09-21 16:34 ` Cleber Rosa
  2017-09-22  8:37 ` Lukáš Doktor
  0 siblings, 2 replies; 6+ messages in thread
From: Eduardo Habkost @ 2017-09-21 16:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Cleber Rosa, Amador Pahim, Fam Zheng, ldoktor,
	stefanha, armbru, mreitz

Not all scripts using qemu.py configure the Python logging
module, and end up generating a "No handlers could be found for
logger" message instead of actual log messages.

To avoid requiring every script using qemu.py to configure
logging manually, call basicConfig() when creating a QEMUMachine
object.  This won't affect scripts that already set up logging,
but will ensure that scripts that don't configure logging keep
working.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Fixes: 4738b0a85a0c2031fddc71b51cccebce0c4ba6b1
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 scripts/qemu.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/qemu.py b/scripts/qemu.py
index 5e02dd8e78..73d6031e02 100644
--- a/scripts/qemu.py
+++ b/scripts/qemu.py
@@ -89,6 +89,9 @@ class QEMUMachine(object):
         self._qmp = None
         self._qemu_full_args = None
 
+        # just in case logging wasn't configured by the main script:
+        logging.basicConfig(level=(logging.DEBUG if debug else logging.WARN))
+
     def __enter__(self):
         return self
 
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-09-24 11:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-21 16:22 [Qemu-devel] [PATCH] qemu.py: Call logging.basicConfig() automatically Eduardo Habkost
2017-09-21 16:34 ` Cleber Rosa
2017-09-22  8:37 ` Lukáš Doktor
2017-09-22  9:40   ` Kevin Wolf
2017-09-24 11:17     ` Lukáš Doktor
2017-09-22 12:47   ` Eduardo Habkost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).