zhangjf 13655445d2 refactor: 后台API日志配置优化
- service.properties: 移除重复日志配置(已由env.properties定义)
- logback-spring.xml: ERROR日志只输出到error.log
  - AOP_FILE/APP_FILE/SQL_FILE/CONSOLE添加ERROR过滤器
  - 更新注释说明配置来源于env.properties
2026-02-26 19:12:57 +08:00

129 lines
3.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ====================================================
# 工作日志服务平台 - 主配置文件
# ====================================================
# ==================== 服务基础配置 ====================
server:
port: 8200
servlet:
context-path: /wlog
# ==================== Spring 配置 ====================
spring:
application:
name: worklog-api
# 导入 service.properties使其参数对 logback-spring.xml 的 springProperty 可见
config:
import: optional:classpath:service.properties
# Jackson 配置
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
default-property-inclusion: non_null
# 数据源配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/worklog?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
username: worklog
password: Wlog@123
type: com.zaxxer.hikari.HikariDataSource
hikari:
minimum-idle: 5
maximum-pool-size: 20
auto-commit: true
idle-timeout: 600000
max-lifetime: 1800000
connection-timeout: 30000
connection-test-query: SELECT 1
# Redis 配置
data:
redis:
host: localhost
port: 6379
password: zjf@123456
database: 0
timeout: 5000ms
lettuce:
pool:
max-active: 8
max-wait: -1ms
max-idle: 8
min-idle: 0
# Nacos 配置(可选,默认禁用)
cloud:
nacos:
discovery:
server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
username: ${NACOS_USERNAME:nacos}
password: ${NACOS_PASSWORD:nacos}
namespace: ${NACOS_NAMESPACE:worklog-dev}
group: ${NACOS_GROUP:DEFAULT_GROUP}
config:
server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
username: ${NACOS_USERNAME:nacos}
password: ${NACOS_PASSWORD:nacos}
namespace: ${NACOS_NAMESPACE:worklog-dev}
file-extension: yml
group: ${NACOS_GROUP:DEFAULT_GROUP}
enabled: false
# ==================== MyBatis-Plus 配置 ====================
mybatis-plus:
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
global-config:
db-config:
id-type: ASSIGN_ID
logic-delete-field: deleted
logic-delete-value: 1
logic-not-delete-value: 0
mapper-locations: classpath*:/mapper/**/*.xml
type-aliases-package: com.wjbl.worklog.data.entity
# ==================== SpringDoc 配置 ====================
springdoc:
swagger-ui:
path: /swagger-ui.html
tags-sorter: alpha
api-docs:
path: /api-docs
group-configs:
- group: 'default'
paths-to-match: '/**'
packages-to-scan: com.wjbl.worklog.controller
# ==================== 腾讯云 COS 配置(可选)====================
tencent:
cos:
enabled: ${COS_ENABLED:false}
app-id: ${COS_APP_ID:1308258046}
secret-id: ${COS_SECRET_ID:}
secret-key: ${COS_SECRET_KEY:}
bucket-name: ${COS_BUCKET_NAME:}
bucket-host: ${COS_BUCKET_HOST:}
region: ${COS_REGION:ap-beijing}
# ==================== 应用自定义配置 ====================
worklog:
# Token 配置
token:
expire-time: 86400 # Token 有效期(秒),默认 24 小时
prefix: "auth:token:"
# 日志内容限制
log:
max-content-length: 2000 # 最大 2000 汉字
# 文件上传配置(如果不使用 COS
upload:
enabled: true
base-path: ./uploads
max-file-size: 10MB
allowed-extensions: jpg,jpeg,png,gif,pdf,doc,docx,xls,xlsx