What is the correct way of configuring Python's logging.FileHandler?

流过昼夜 提交于 2019-12-01 12:10:05

So, apparently I can use Python expressions inside the configuration file:

[handler_fileHandler]
  <snip>
args=(os.path.join(sys.path[0],'echi_export.log'), 'a',)

This results in the logfile being created in the same directory the script resides in.

(os.path.dirname(__file__) resolves to /usr/lib/python2.7/logging/ on my system, which is probably where the logging module resides).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!