From 2fd6c6b549de5f4d36f7b626248bd5c374e9ef05 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 19 Dec 2018 12:13:24 -0800 Subject: [PATCH] Add timestamps to program.log and dnf.log In lorax, lorax-composer, and livemedia-creator. (cherry picked from commit fd173f726589ce542c3aa2835d8d95bc6e7e49a0) --- src/pylorax/__init__.py | 2 ++ src/sbin/lorax | 2 ++ src/sbin/lorax-composer | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 4f4fd837..c7d5ac07 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -429,6 +429,8 @@ def setup_logging(logfile, theLogger): f = os.path.abspath(os.path.dirname(logfile))+"/program.log" fh = logging.FileHandler(filename=f, mode="w") fh.setLevel(logging.DEBUG) + fmt = logging.Formatter("%(asctime)s %(levelname)s: %(message)s") + fh.setFormatter(fmt) program_log.addHandler(fh) diff --git a/src/sbin/lorax b/src/sbin/lorax index eca8b0f0..c08ccf8b 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -84,6 +84,8 @@ def setup_logging(opts): logfile = os.path.abspath(os.path.dirname(opts.logfile))+"/dnf.log" fh = logging.FileHandler(filename=logfile, mode="w") fh.setLevel(logging.NOTSET) + fmt = logging.Formatter("%(asctime)s %(levelname)s: %(message)s") + fh.setFormatter(fmt) dnf_log.addHandler(fh) # Setup librepo logging diff --git a/src/sbin/lorax-composer b/src/sbin/lorax-composer index 4690032f..37496a0a 100755 --- a/src/sbin/lorax-composer +++ b/src/sbin/lorax-composer @@ -69,6 +69,8 @@ def setup_logging(logfile): logfile = os.path.abspath(os.path.dirname(logfile))+"/program.log" fh = logging.FileHandler(filename=logfile) fh.setLevel(logging.DEBUG) + fmt = logging.Formatter("%(asctime)s %(levelname)s: %(message)s") + fh.setFormatter(fmt) program_log.addHandler(fh) # Server request logging @@ -83,6 +85,8 @@ def setup_logging(logfile): logfile = os.path.abspath(os.path.dirname(logfile))+"/dnf.log" fh = logging.FileHandler(filename=logfile) fh.setLevel(logging.DEBUG) + fmt = logging.Formatter("%(asctime)s %(levelname)s: %(message)s") + fh.setFormatter(fmt) dnf_log.addHandler(fh)