Commit 5810314e authored by Eduardo Habkost's avatar Eduardo Habkost
Browse files

qemu.py: Call logging.basicConfig() automatically



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: default avatarKevin Wolf <kwolf@redhat.com>
Fixes: 4738b0a8
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170921162234.847-1-ehabkost@redhat.com>
Reviewed-by: default avatarCleber Rosa <crosa@redhat.com>
Acked-by: default avatarLukáš Doktor <ldoktor@redhat.com>
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
parent 9ee660e7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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