main.py
from logger.logger import logging
logging.debug("恢复健康收到回复开始的考核积分换技术可兑换积分考核时间看到")
logger/logger.py
import logging
import os
# 绝对路径
current_path = os.path.abspath(__file__) # 当前文件的绝对路径
dirname_path = os.path.dirname(current_path) # 当前目录的绝对路径
logs_path_fake = os.path.join(dirname_path, '../logs/log.log')
log_path = os.path.abspath(logs_path_fake)
logging.basicConfig(level=logging.DEBUG, filename=log_path)