diff options
author | Jun Wang <junbill.wang@samsung.com> | 2016-02-04 23:05:20 +0800 |
---|---|---|
committer | Jun Wang <junbill.wang@samsung.com> | 2016-02-29 18:45:24 +0800 |
commit | c6438b3e4ca4ad5db0bac0f3cb76c0ada7cd0f84 (patch) | |
tree | 4f7ab3cf5ff02ea973cf74cea75c4f7eff012290 | |
parent | 91894415dc3a1e4f3056b680ffab9e737aed0f50 (diff) | |
download | git-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.py | 4 | ||||
-rw-r--r-- | gbp/rpm/lib_rpm.py | 1 |
2 files changed, 3 insertions, 2 deletions
@@ -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) |