From 3e5c0707bb01bc0e3cbed32af3933c2641c0064b Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 27 Nov 2017 15:24:16 -0800 Subject: [PATCH] Redirect yum's logging to yum.log --- src/pylorax/api/yumbase.py | 2 ++ src/sbin/lorax-composer | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/pylorax/api/yumbase.py b/src/pylorax/api/yumbase.py index 18377e68..996bfeca 100644 --- a/src/pylorax/api/yumbase.py +++ b/src/pylorax/api/yumbase.py @@ -22,6 +22,8 @@ from fnmatch import fnmatchcase from glob import glob import os import yum +# This is a hack to short circuit yum's internal logging +yum.logginglevels._added_handlers = True from pylorax.sysutils import joinpaths diff --git a/src/sbin/lorax-composer b/src/sbin/lorax-composer index 2c3df668..d9c45015 100755 --- a/src/sbin/lorax-composer +++ b/src/sbin/lorax-composer @@ -22,6 +22,7 @@ log = logging.getLogger("lorax-composer") program_log = logging.getLogger("program") pylorax_log = logging.getLogger("pylorax") server_log = logging.getLogger("server") +yum_log = logging.getLogger("yum") import argparse import os @@ -96,6 +97,13 @@ def setup_logging(logfile): fh.setLevel(logging.DEBUG) server_log.addHandler(fh) + # YUM logging + yum_log.setLevel(logging.DEBUG) + logfile = os.path.abspath(os.path.dirname(logfile))+"/yum.log" + fh = logging.FileHandler(filename=logfile) + fh.setLevel(logging.DEBUG) + yum_log.addHandler(fh) + class LogWrapper(object): """Wrapper for the WSGIServer which only calls write()"""