From a83727242a1a6f044adfab39e6cf6466f0719259 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 9 Jul 2012 20:16:54 -0700 Subject: Add more information about why we are returning early and why we don't convert a string that is a filename to a string buffer/io like object. --- cloudinit/log.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cloudinit/log.py b/cloudinit/log.py index 76a2c5e0..0c6938d6 100644 --- a/cloudinit/log.py +++ b/cloudinit/log.py @@ -78,17 +78,21 @@ def setupLogging(cfg=None): am_tried += 1 # Assume its just a string if not a filename if log_cfg.startswith("/") and os.path.isfile(log_cfg): + # Leave it as a file and do not make it look like + # something that is a file (but is really a buffer that + # is acting as a file) pass else: log_cfg = StringIO(log_cfg) # Attempt to load its config logging.config.fileConfig(log_cfg) + # The first one to work wins! return except Exception: - # we do not write any logs of this here, because the default + # We do not write any logs of this here, because the default # configuration includes an attempt at using /dev/log, followed # up by writing to a file. /dev/log will not exist in very early - # boot, so an exception on that is expected. + # boot, so an exception on that is expected. pass # If it didn't work, at least setup a basic logger (if desired) -- cgit v1.2.3