logging配置如下:
logging.basicConfig(level=logging.DEBUG,\
format="%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s",\
datefmt="%a, %d %b %Y %H:%M:%S",\
filename="i2_insert_equipments.log",\
filemode="w")
但当在代码中使用logging.info的时候,目录下无日志文件生成。但当在控制台中运行的时候,是可以正常运行的,有知道这种现象如何解决的么? 望告知一下,谢谢。
If you don’t know how to use it, I’ll give you an example
The problem with filename is that you specify an absolute path and then try again, filemode="w". If you do this, a new file will be generated every time,
The environment under the interactive command line is different, especially for certain operations involving files and systems. For example, you can try creating a new process under the interactive command line.