I configed my logging in below config file, where I have a "filelog" to write the logging info into a file by using:
flog = logging.getLogger(__file__)
flog.info('write!')
However, I want to specify a different file to log to everytime I run. Now I can only write to C:/record.log
How can I pass in a paramter to indicate which file I want to write to?
[loggers]
keys: root, file
[formatters]
keys: detailed,simple
[handlers]
keys: console,filelog
[formatter_simple]
format: %(asctime)s-%(name)s-%(levelname)s: %(message)s
[formatter_detailed]
format: %(asctime)s-%(name)s-%(levelname)s-%(lineno)d: %(message)s
[handler_console]
class: StreamHandler
args: []
formatter: detailed
[handler_filelog]
class: handlers.RotatingFileHandler
args: ('C:/record.log','a', 1000000, 5)
formatter: detailed
[logger_root]
level: DEBUG
handlers: console
[logger_file]
level: INFO
qualname: file
handlers: filelog