mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 08:20:31 +08:00
fix: bundle recognition-logback.xml into fat JAR as classpath resource
- Copy recognition-logback.xml to starter/src/main/resources/ - Set logging.config=classpath:recognition-logback.xml - Eliminates dependency on external --logging.config parameter
This commit is contained in:
+2
-1
@@ -35,7 +35,8 @@ spring.redis.pool.max-idle=8
|
||||
logging.path=/tmp/ninca-component-org-verify-logs
|
||||
logging.level.root=INFO
|
||||
|
||||
# 日志实现由 run-verify.sh 传入 --logging.config=file:…/recognition-logback.xml(勿在此处写 classpath:recognition-logback.xml,以免覆盖失效)
|
||||
# --- 日志配置 (classpath 内置) ---
|
||||
logging.config=classpath:recognition-logback.xml
|
||||
|
||||
# --- Spring 通用(与部署包一致)---
|
||||
spring.jackson.time-zone=GMT+8
|
||||
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--debug 实时查看logback运行状态,默认值为false-->
|
||||
<!--scan 配置文件将每分钟扫描一次更改,配置文件如果发生改变,将会被重新加载,默认值为true-->
|
||||
<!--scanPeriod 配置文件扫描周期,当不设置单位时默认为毫秒级。-->
|
||||
<!--packagingData 可以在日志后看到依赖jar包名和版本,很费性能,不建议开启 -->
|
||||
<configuration debug="true" scan="true" scanPeriod="30 seconds" packagingData="false">
|
||||
|
||||
<property name="application-name" value="component-organization"/>
|
||||
|
||||
<contextName>${application-name}</contextName>
|
||||
<!--读取spring的配置文件,日志路径-->
|
||||
<springProperty scope="context" name="file_path" source="logging.path" defaultValue="./logs"/>
|
||||
<!--读取spring的配置文件,info级别日志总大小-->
|
||||
<springProperty scope="context" name="info_file_index_max" source="logging.file.info.max-index"
|
||||
defaultValue="20"/>
|
||||
<!--读取spring的配置文件,error级别日志总大小-->
|
||||
<springProperty scope="context" name="error_file_index_max" source="logging.file.error.max-index"
|
||||
defaultValue="20"/>
|
||||
|
||||
<property name="file_name_prefix" value="${file_path}/${application-name}"/>
|
||||
|
||||
<!--控制台打印格式-->
|
||||
<property name="log_pattern"
|
||||
value="[%d{yyyy-MM-dd HH:mm:ss.SSSZ}] [%X{X-B3-TraceId}] [%thread] [%level] [%logger{36}] [%line] %msg%n"/>
|
||||
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log_pattern}</pattern>
|
||||
<charset>utf8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--info-->
|
||||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${file_path}/${application-name}.info.log</file>
|
||||
<encoder>
|
||||
<pattern>${log_pattern}</pattern>
|
||||
</encoder>
|
||||
<!--FixedWindowRollingPolicy 翻转策略, -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<fileNamePattern>${file_name_prefix}.info.%i.log</fileNamePattern>
|
||||
<!--最小索引 例如:fareid-app.error.1.log-->
|
||||
<minIndex>1</minIndex>
|
||||
<!--最大索引 例如:fareid-app.error.20.log-->
|
||||
<maxIndex>${info_file_index_max}</maxIndex>
|
||||
</rollingPolicy>
|
||||
|
||||
<!--如果超过指定大小会告知 RollingFileAppender 触发当前活动文件滚动-->
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<!--每个文件最大保存大小-->
|
||||
<maxFileSize>30MB</maxFileSize>
|
||||
</triggeringPolicy>
|
||||
</appender>
|
||||
|
||||
|
||||
<!--error-->
|
||||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${file_path}/${application-name}.error.log</file>
|
||||
<encoder>
|
||||
<pattern>${log_pattern}</pattern>
|
||||
</encoder>
|
||||
<!--FixedWindowRollingPolicy 翻转策略, -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<fileNamePattern>${file_name_prefix}.error.%i.log</fileNamePattern>
|
||||
<!--最小索引 例如:fareid-app.error.1.log-->
|
||||
<minIndex>1</minIndex>
|
||||
<!--最大索引 例如:fareid-app.error.20.log-->
|
||||
<maxIndex>${error_file_index_max}</maxIndex>
|
||||
</rollingPolicy>
|
||||
|
||||
<!--如果超过指定大小会告知 RollingFileAppender 触发当前活动文件滚动-->
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<!--每个文件最大保存大小-->
|
||||
<maxFileSize>30MB</maxFileSize>
|
||||
</triggeringPolicy>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="INFO_FILE"/>
|
||||
<appender-ref ref="ERROR_FILE"/>
|
||||
</root>
|
||||
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user