diff --git a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/accounts/PositionCheckService.kt b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/accounts/PositionCheckService.kt index 4cfff21..ee25e64 100644 --- a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/accounts/PositionCheckService.kt +++ b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/accounts/PositionCheckService.kt @@ -398,7 +398,7 @@ class PositionCheckService( } else { // 有仓位,按订单下单顺序(FIFO)更新状态 // 计算逻辑: - // 1. 总订单数量 = 所有未卖出订单的剩余数量总和 + // 1. 总订单数量 = 所有未卖出订单的剩余数量总和 // 2. 已成交数量 = 总订单数量 - 仓位数量(因为还有仓位,说明部分订单已卖出) // 3. 如果已成交数量 = 0,说明订单还没有卖出,不修改订单状态 // 4. 如果已成交数量 > 0,按FIFO顺序匹配订单 diff --git a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/common/MarketPriceService.kt b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/common/MarketPriceService.kt index c9df632..ef620fc 100644 --- a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/common/MarketPriceService.kt +++ b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/common/MarketPriceService.kt @@ -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) } diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index ef73a28..68f0b3a 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -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 配置 diff --git a/deploy.sh b/deploy.sh index 3191b1e..d622803 100755 --- a/deploy.sh +++ b/deploy.sh @@ -76,6 +76,11 @@ JWT_SECRET=${JWT_SECRET} # 管理员密码重置密钥(已自动生成随机值,生产环境建议修改) ADMIN_RESET_PASSWORD_KEY=${ADMIN_RESET_KEY} + +# 日志级别配置(可选,默认值:root=INFO, app=DEBUG) +# 可选值:TRACE, DEBUG, INFO, WARN, ERROR, OFF +# LOG_LEVEL_ROOT=INFO +# LOG_LEVEL_APP=DEBUG EOF info ".env 文件已创建,已自动生成随机密码和密钥" warn "生产环境建议修改以下参数:" diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 6ecb88c..12d1765 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -29,6 +29,10 @@ services: # 生成随机密钥:openssl rand -hex 32 (ADMIN_RESET_PASSWORD_KEY) 或 openssl rand -hex 64 (JWT_SECRET) - JWT_SECRET=${JWT_SECRET:-change-me-in-production} - ADMIN_RESET_PASSWORD_KEY=${ADMIN_RESET_PASSWORD_KEY:-change-me-in-production} + # 日志级别配置(可选,默认值:root=INFO, app=DEBUG) + # 可选值:TRACE, DEBUG, INFO, WARN, ERROR, OFF + - LOG_LEVEL_ROOT=${LOG_LEVEL_ROOT:-INFO} + - LOG_LEVEL_APP=${LOG_LEVEL_APP:-DEBUG} depends_on: mysql: condition: service_healthy diff --git a/docker-compose.yml b/docker-compose.yml index d7f94c8..c1efeb3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,6 +27,10 @@ services: # 生成随机密钥:openssl rand -hex 32 (ADMIN_RESET_PASSWORD_KEY) 或 openssl rand -hex 64 (JWT_SECRET) - JWT_SECRET=${JWT_SECRET:-change-me-in-production} - ADMIN_RESET_PASSWORD_KEY=${ADMIN_RESET_PASSWORD_KEY:-change-me-in-production} + # 日志级别配置(可选,默认值:root=INFO, app=DEBUG) + # 可选值:TRACE, DEBUG, INFO, WARN, ERROR, OFF + - LOG_LEVEL_ROOT=${LOG_LEVEL_ROOT:-INFO} + - LOG_LEVEL_APP=${LOG_LEVEL_APP:-DEBUG} depends_on: mysql: condition: service_healthy