From fd8684f1afc5428c6070f5660e5b5d9e388b96c3 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 12 Mar 2013 14:09:21 -0700 Subject: [PATCH] Add yum logging to yum.log --- src/sbin/lorax | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/sbin/lorax b/src/sbin/lorax index 2a66cd3b..d831b971 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -26,6 +26,7 @@ import logging log = logging.getLogger("lorax") program_log = logging.getLogger("program") pylorax_log = logging.getLogger("pylorax") +yum_log = logging.getLogger("yum") import sys @@ -35,6 +36,9 @@ from optparse import OptionParser, OptionGroup import ConfigParser import yum +# This is a bit of a hack to short circuit yum's internal logging +# handler setup. We already set one up so we don't need it to run. +yum.logginglevels._added_handlers = True import pylorax def setup_logging(opts): @@ -63,6 +67,13 @@ def setup_logging(opts): fh.setLevel(logging.DEBUG) program_log.addHandler(fh) + # yum logging + yum_log.setLevel(logging.DEBUG) + logfile = os.path.abspath(os.path.dirname(opts.logfile))+"/yum.log" + fh = logging.FileHandler(filename=logfile, mode="w") + fh.setLevel(logging.DEBUG) + yum_log.addHandler(fh) + def main(args): version = "{0} 0.1".format(os.path.basename(args[0])) @@ -260,6 +271,12 @@ def get_yum_base_object(installroot, repositories, mirrorlists=[], yb.preconf.root = installroot #yb.repos.setCacheDir(cachedir) + # Turn on as much yum logging as we can + yb.preconf.debuglevel = 6 + yb.preconf.errorlevel = 6 + yb.logger.setLevel(logging.DEBUG) + yb.verbose_logger.setLevel(logging.DEBUG) + return yb