I am trying to convert my current projects from python 2.7 to 3.5. One of the first tasks is configuration of logging. I use a configuration file for flexibility and the date is part of the file name. Below is the code for setting up the file handler that works fine in 2.7
[handler_fileHandler]
class=FileHandler
level=DEBUG
formatter=simpleFormatter
# Only one log per day will be created. All messages will be appended to it.
args=("D:\\Logs\\PyLogs\\" + time.strftime("%Y%m%d%H%M%S")+'.log', 'a')
In 3.5 the following error occurs:
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%Y%m%d%H%M%S")+\'.log\', \'a\')'
Has anyone experience with this? Is there a better way to format the date within the configuration file?
TimedRotatingFileHandlerthough?class=TimedRotatingFileHandler, withwhen='D'.