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.
This commit is contained in:
parent
ff2f43ae68
commit
943f30aaef
@ -78,14 +78,18 @@ def setupLogging(cfg=None):
|
|||||||
am_tried += 1
|
am_tried += 1
|
||||||
# Assume its just a string if not a filename
|
# Assume its just a string if not a filename
|
||||||
if log_cfg.startswith("/") and os.path.isfile(log_cfg):
|
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
|
pass
|
||||||
else:
|
else:
|
||||||
log_cfg = StringIO(log_cfg)
|
log_cfg = StringIO(log_cfg)
|
||||||
# Attempt to load its config
|
# Attempt to load its config
|
||||||
logging.config.fileConfig(log_cfg)
|
logging.config.fileConfig(log_cfg)
|
||||||
|
# The first one to work wins!
|
||||||
return
|
return
|
||||||
except Exception:
|
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
|
# configuration includes an attempt at using /dev/log, followed
|
||||||
# up by writing to a file. /dev/log will not exist in very early
|
# 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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user