logging.config.fileConfig FileHandler configure to write to APP_DATA

Jeffrey Britton jeffb0098 at gmail.com
Mon Apr 16 17:01:39 EDT 2012


I have a logging configuration file that I load via
logging.config.fileConfig.
The configuration file, configures a FileHandler to log to file.
I wish to initialize the FileHandler to the path
os.environ['APP_DATA'].
However, I don't know how to configure anything other than a static
path.


I also don't know how to modify the initialization after loading via
fileConfig.
For example, if I could do something like this then I could make it
work for me.
logging.config.fileConfig('logging.conf')
for logger in enumerate_all_loggers():
    logger.addHandler( FileHandler(logfilename, mode='w'))




More information about the Python-list mailing list