[lorax 1/2] Add yum logging to yum.log
Brian C. Lane
bcl at redhat.com
Wed Mar 13 00:00:24 UTC 2013
From: "Brian C. Lane" <bcl at redhat.com>
---
src/sbin/lorax | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/sbin/lorax b/src/sbin/lorax
index 2a66cd3..d831b97 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
--
1.8.1.2
More information about the anaconda-patches
mailing list