我有一个python应用程序,它使用模块“logging”并用pysintaller打包。在
我正在使用以下格式字符串:
%(asctime)s %(levelname)s [%(threadName)s:%(module)s.%(funcName)s()] %(message)s
如果我以python脚本运行应用程序,它可以正常工作,“(module)s.%(funcName)s”将替换为调用模块和函数的实际值:
^{pr2}$但是,如果我用pyinstaller打包我的应用程序,它现在会替代'日志记录.debug'对于“%(module)s.%(funcName)s':
2014-06-19 19:04:05,577 DEBUG [MainThread:logging.debug()] Executing `echo hello` on server centos6root
2014-06-19 19:04:05,577 DEBUG [MainThread:logging.debug()] Trying to connect to server centos6root
2014-06-19 19:04:06,293 DEBUG [MainThread:logging.debug()] Established connection with root@192.168.122.57:22
2014-06-19 19:04:06,705 DEBUG [MainThread:logging.debug()] exitstatus = 0
2014-06-19 19:04:06,707 DEBUG [MainThread:logging.debug()] Closed connection to server centos6root
2014-06-19 19:04:06,707 DEBUG [MainThread:logging.debug()] Application finished
原因是什么?如何纠正这种行为?在
我使用的是直接调用
logging.info()
,logging.debug()
等通过对每个模块使用单独的记录器解决了这个问题
并调用
logger.info()
,logger.debug()
等相关问题 更多 >
编程相关推荐