Py学习  »  Python

python logging 使用动态文件名

Py站长 • 10 年前 • 3186 次点击  

Change your handler_fileHandler section like so:

[handler_fileHandler]
class=FileHandler
level=DEBUG
formatter=fileFormatter
args=('%(logfilename)s',)

and then add a defaults argument to the fileConfig call

logging.fileConfig(loginipath, defaults={'logfilename': '/var/log/mylog.log'})
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/1060