Skip to content

Commit

Permalink
qemu.py: Call logging.basicConfig() automatically
Browse files Browse the repository at this point in the history
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: 4738b0a
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170921162234.847-1-ehabkost@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Acked-by: Lukáš Doktor <ldoktor@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
  • Loading branch information
ehabkost committed Sep 22, 2017
1 parent 9ee660e commit 5810314
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/qemu.py
Expand Up @@ -89,6 +89,9 @@ def __init__(self, binary, args=None, wrapper=None, name=None,
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

Expand Down

0 comments on commit 5810314

Please sign in to comment.