Closed tjwilli58 closed 5 years ago
I think the source my confusion is that the formatting of the logging module LogRecord attributes Is identical to the 'ConfigParser' interpolation. I changed the interpolation to 'Template', then made sure to change the confiobj key values to have that format, while leaving the format statement alone, e.g.
[MainWindow]
NumCameras = 1
RootDir = TestData
CaptureDrive = "C:/"
LogFile = ${CaptureDrive}${RootDir)/test.log
[logging]
version = 1
level = INFO
[[formatters]]
[[[fmt1]]]
format = %(asctime)s: (%(levelname)s) %(message)s
datefmt =
[[handlers]]
[[[console]]]
class = logging.StreamHandler
level = INFO
stream = ext://sys.stderr
formatter = fmt1
[[[file]]]
class = logging.FileHandler
level = INFO
mode = a
formatter = fmt1
filename = C:/TestData/test_20190530.log
[[loggers]]
[[[root]]]
level = INFO
handlers = console, file
I'm having a problem using configobj with interpolation to configure a logger. Everything works fine with python3.4, python3.5, but for python3.5 and above, I get an exception.
Here is my test program:
and my INI file:
running under python3.4 or python 3.5:
It could be a bug in logging.config, but I'm thinking it may be somewhere in configobj.interpolate()
Thanks for any help