原因分析,python3启动时,检索的不是项目包下的目录文件,所以日志文件必须指明路径。我原来的日志方式是:
import logging.config
log_path = "mlpcap/config/logger.config"
logging.config.fileConfig(log_path )
logger = logging.getLogger("predict")
修改为:
log_path = "mlpcap/config/logger.config"
log_file_path = path.join(path.dirname(path.abspath(__file__)), log_path)
logging.config.fileConfig(log_file_path)
logger = logging.getLogger("predict")