当我在终端运行以下代码时,它创建了一个日志文件
import logging
logging.basicConfig(filename='ramexample.log',level=logging.DEBUG)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too')
但当我在PyCharm中运行同样的代码(用不同的filename='ram.log'
)时,它没有创建任何日志文件。为什么呢?
import logging
logging.basicConfig(filename='ram.log',level=logging.DEBUG)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too')
要用PyCharm创建一个日志文件,我必须做什么?