[node-patches] Change in ovirt-node[master]: logging: Adding NullHandler to logs
dougsland at redhat.com
dougsland at redhat.com
Wed Jun 17 21:19:43 UTC 2015
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: logging: Adding NullHandler to logs
......................................................................
logging: Adding NullHandler to logs
To avoid the "No handlers could be found" message
into the consumers of ovirt-node python modules
this patch adds the NullHandler [1].
[1] https://docs.python.org/2/howto/logging.html#library-config
Change-Id: I6e3321f46122161a08e8db1b18684eef0ecf8d27
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M src/ovirt/node/utils/fs/__init__.py
M src/ovirtnode/install.py
M src/ovirtnode/ovirtfunctions.py
M src/ovirtnode/storage.py
4 files changed, 5 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/22/42522/1
diff --git a/src/ovirt/node/utils/fs/__init__.py b/src/ovirt/node/utils/fs/__init__.py
index 098e786..39c1785 100644
--- a/src/ovirt/node/utils/fs/__init__.py
+++ b/src/ovirt/node/utils/fs/__init__.py
@@ -39,6 +39,7 @@
from ... import base
LOGGER = logging.getLogger(__name__)
+LOGGER.addHandler(logging.NullHandler())
def get_contents(src):
diff --git a/src/ovirtnode/install.py b/src/ovirtnode/install.py
index c109473..e125daa 100755
--- a/src/ovirtnode/install.py
+++ b/src/ovirtnode/install.py
@@ -31,11 +31,12 @@
OVIRT_VARS = _functions.parse_defaults()
from ovirtnode.storage import Storage
-logger = logging.getLogger(_functions.PRODUCT_SHORT)
+logger = logging.getLogger(__name__)
class Install:
def __init__(self):
+ logger.addHandler(logging.NullHandler())
logger.propagate = False
self.disk = None
self.partN = -1
diff --git a/src/ovirtnode/ovirtfunctions.py b/src/ovirtnode/ovirtfunctions.py
index 4f0f241..a51abde 100644
--- a/src/ovirtnode/ovirtfunctions.py
+++ b/src/ovirtnode/ovirtfunctions.py
@@ -1867,3 +1867,4 @@
logger = setup_custom_logger()
else:
logger = logging.getLogger(__name__)
+ logger.addHandler(logging.NullHandler())
diff --git a/src/ovirtnode/storage.py b/src/ovirtnode/storage.py
index 544e774..b0c9020 100644
--- a/src/ovirtnode/storage.py
+++ b/src/ovirtnode/storage.py
@@ -33,7 +33,7 @@
class Storage:
def __init__(self):
- logger = logging.getLogger(_functions.PRODUCT_SHORT)
+ logger.addHandler(logging.NullHandler())
logger.propagate = False
OVIRT_VARS = _functions.parse_defaults()
self.overcommit = 0.5
--
To view, visit https://gerrit.ovirt.org/42522
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e3321f46122161a08e8db1b18684eef0ecf8d27
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>
More information about the node-patches
mailing list