Why does this code for creating a Python log not w

2019-09-16 06:12发布

I'm trying to get the Python logging module to work:

The code:

import logging
import os

LOG_FILENAME = os.path.join(r'D:\MPhil\Model_Building\Models\Exercises\MCMC\MCMC_in_python\AtoB','CopasiMC.log')
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG,filemode='w')
logging.debug('This message should go to the log file')

Doesn't do anything. My goal is to use this code in a if __name__=='__main__:' block then use this log to document code progress as I write a set of python classes. Can anybody tell me why this isn't working.

0条回答
登录 后发表回答