原因分析,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")

 

相关文章:

  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2021-07-27
  • 2022-12-23
猜你喜欢
  • 2021-08-20
  • 2021-11-05
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案