summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Wang <junbill.wang@samsung.com>2016-02-04 23:05:20 +0800
committerJun Wang <junbill.wang@samsung.com>2016-02-29 18:45:24 +0800
commitc6438b3e4ca4ad5db0bac0f3cb76c0ada7cd0f84 (patch)
tree4f7ab3cf5ff02ea973cf74cea75c4f7eff012290
parent91894415dc3a1e4f3056b680ffab9e737aed0f50 (diff)
downloadgit-buildpackage-c6438b3e4ca4ad5db0bac0f3cb76c0ada7cd0f84.tar.gz
git-buildpackage-c6438b3e4ca4ad5db0bac0f3cb76c0ada7cd0f84.tar.bz2
git-buildpackage-c6438b3e4ca4ad5db0bac0f3cb76c0ada7cd0f84.zip
Fix errors logs when __import__ faild,like "No handlers could be found fo logger"
Change-Id: I785e402e13879c6010780d3a453ea78956833fe1
-rw-r--r--gbp/log.py4
-rw-r--r--gbp/rpm/lib_rpm.py1
2 files changed, 3 insertions, 2 deletions
diff --git a/gbp/log.py b/gbp/log.py
index 5f8ae107..7b9a4aa8 100644
--- a/gbp/log.py
+++ b/gbp/log.py
@@ -172,8 +172,8 @@ def _parse_color_scheme(color_scheme=""):
def getLogger(*args, **kwargs):
"""Gbp-specific function"""
-# if not issubclass(logging.getLoggerClass(), GbpLogger):
- logging.setLoggerClass(GbpLogger)
+ if not issubclass(logging.getLoggerClass(), GbpLogger):
+ logging.setLoggerClass(GbpLogger)
color = kwargs.pop('color') if 'color' in kwargs else 'auto'
logger = logging.getLogger(*args, **kwargs)
if hasattr(logger, 'default_handlers') and not logger.default_handlers:
diff --git a/gbp/rpm/lib_rpm.py b/gbp/rpm/lib_rpm.py
index 4bad44e7..da914207 100644
--- a/gbp/rpm/lib_rpm.py
+++ b/gbp/rpm/lib_rpm.py
@@ -25,6 +25,7 @@ try:
# Try to load special RPM lib to be used for GBP (only)
librpm = __import__(RpmPkgPolicy.python_rpmlib_module_name)
except ImportError:
+ gbp.log.getLogger("gbp")
gbp.log.warn("Failed to import '%s' as rpm python module, using host's "
"default rpm library instead" %
RpmPkgPolicy.python_rpmlib_module_name)