Redirect yum's logging to yum.log

This commit is contained in:
Brian C. Lane 2017-11-27 15:24:16 -08:00
parent a44e499eee
commit 3e5c0707bb
2 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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()"""