天天看點

python 中實用logging日志

from logger.logger import logging

logging.debug("恢複健康收到回複開始的考核積分換技術可兌換積分考核時間看到")      
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)