logging.config.fileConfig FileHandler configure to write to APP_DATA

Jeffrey Britton jeffb0098 at gmail.com
Mon Apr 16 18:20:37 EDT 2012


I figured out what I was after.
logfn = os.path.join(os.environ['APPDATA'], directory, filename)
ensure_path(logfn)
logging.config.fileConfig("logging.conf", defaults={'logfn': logfn})
In the config file use:
[handler_fileHandler]
class=FileHandler
level=DEBUG
formatter=simpleFormatter
args=(r'%(logfn)s', 'w')


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /