feat: 添加 Docker 部署日志级别环境变量支持

- 在 application.properties 中支持通过 LOG_LEVEL_ROOT 和 LOG_LEVEL_APP 环境变量配置日志级别
- 在 docker-compose.yml 和 docker-compose.prod.yml 中添加日志级别环境变量配置
- 在 deploy.sh 的 .env 模板中添加日志级别配置说明
- 支持通过环境变量动态配置日志级别,无需修改配置文件
- 默认值:root=INFO, app=DEBUG
This commit is contained in:
WrBug
2026-01-07 11:26:03 +08:00
parent 3d603cac32
commit 9a00bb19dc
6 changed files with 19 additions and 6 deletions
@@ -398,7 +398,7 @@ class PositionCheckService(
} else {
// 有仓位,按订单下单顺序(FIFO)更新状态
// 计算逻辑:
// 1. 总订单数量 = 所有未卖出订单的剩余数量总和
// 1. 总订单数量 = 所有未卖出订单的剩余数量总和
// 2. 已成交数量 = 总订单数量 - 仓位数量(因为还有仓位,说明部分订单已卖出)
// 3. 如果已成交数量 = 0,说明订单还没有卖出,不修改订单状态
// 4. 如果已成交数量 > 0,按FIFO顺序匹配订单
@@ -119,7 +119,7 @@ class MarketPriceService(
if (isRpcError) {
logger.warn("链上查询市场条件出现 RPC 错误(execution reverted),可能市场不存在或尚未创建: marketId=$marketId, error=${e.message}")
} else {
logger.debug("链上查询市场条件失败,降级到 API 查询: marketId=$marketId, error=${e.message}")
logger.debug("链上查询市场条件失败,降级到 API 查询: marketId=$marketId, error=${e.message}")
}
Pair(null, isRpcError)
}
@@ -129,7 +129,7 @@ class MarketPriceService(
if (isRpcError) {
logger.warn("链上查询市场条件异常(execution reverted: marketId=$marketId, outcomeIndex=$outcomeIndex, error=${e.message}")
} else {
logger.debug("链上查询市场条件异常: marketId=$marketId, outcomeIndex=$outcomeIndex, error=${e.message}")
logger.debug("链上查询市场条件异常: marketId=$marketId, outcomeIndex=$outcomeIndex, error=${e.message}")
}
Pair(null, isRpcError)
}
@@ -29,9 +29,9 @@ server.port=${SERVER_PORT:8000}
# 默认使用 dev 环境,可通过 --spring.profiles.active=prod 切换
spring.profiles.active=${SPRING_PROFILES_ACTIVE:dev}
# 日志配置
logging.level.root=INFO
logging.level.com.wrbug.polyhermes=DEBUG
# 日志配置(支持通过环境变量配置)
logging.level.root=${LOG_LEVEL_ROOT:INFO}
logging.level.com.wrbug.polymarketbot=${LOG_LEVEL_APP:DEBUG}
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} - %msg%n
# Polymarket API 配置