I am looking for a way to use the ExtendedInterpolation functionality found in the configparser lib file when loading in the ini file in Logging.config.FileConfig.
http://docs.python.org/3/library/configparser#configparser.ExtendedInterpolation
So, if I have an ini file that looks like this:
[logSettings] eventlogs=application logfilepath=C:\Programs\dk_test\results\dklog_009.log levelvalue=10 [formatters] keys=dkeventFmt,dklogFmt [handlers] keys=dklogHandler [handler_dklogHandler] class=FileHandler level=${logSettings:levelvalue} formatter=dklogFmt args=(${logSettings:logfilepath}, 'w') [logger_dklog] level=${logSettings:levelvalue} handlers=dklogHandler
As you can see, I follow the syntax of extended interpolation using the notation $ {...} to refer to the value in another section. When calling such a logging.config.fileConfig(filepath) file, eval'ing inside the module always fails. In paticular on eval'ing the args option in the [handler_dklogHandler] section.
Is there any way around this? Thanks!
Note: Using Python 3.2
source share