梳理 logback-spring.xml 配置文件
This commit is contained in:
parent
e351cdf785
commit
33ab45fd00
|
@ -58,7 +58,7 @@ public class BizTraceAspect {
|
||||||
span.setTag(BizTrace.TYPE_TAG, StrUtil.toString(SpElUtil.analysisSpEl(trace.type(), joinPoint)));
|
span.setTag(BizTrace.TYPE_TAG, StrUtil.toString(SpElUtil.analysisSpEl(trace.type(), joinPoint)));
|
||||||
span.setTag(BizTrace.ID_TAG, StrUtil.toString(SpElUtil.analysisSpEl(trace.id(), joinPoint)));
|
span.setTag(BizTrace.ID_TAG, StrUtil.toString(SpElUtil.analysisSpEl(trace.id(), joinPoint)));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
log.error("[around][解析 bizType 与 bizId 发生异常]", ex);
|
log.error("[setBizTag][解析 bizType 与 bizId 发生异常]", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,7 @@ spring:
|
||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
path: ${user.home}/logs/ # 日志文件的路径
|
path: ${user.home}/logs/ # 日志文件的路径
|
||||||
|
name: ${spring.application.name} # 日志文件名
|
||||||
|
|
||||||
--- #################### 芋道相关配置 ####################
|
--- #################### 芋道相关配置 ####################
|
||||||
|
|
||||||
|
|
|
@ -1,70 +1,62 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<!-- 变量 -->
|
||||||
|
<springProperty scope="context" name="yudao.info.base-package" source="yudao.info.base-package"/>
|
||||||
|
<property name="PATTERN_DEFAULT" value="%d{yyyy-MM-dd HH:mm:ss.SSS} | %tid | %thread | %-5level | %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台 Appender -->
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
<pattern>%d{ISO8601} | %tid | %thread | %-5level | %msg%n</pattern>
|
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||||
</layout>
|
</layout>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
<!-- 文件 Appender -->
|
||||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<FileNamePattern>./logs/ruoyi-vue-pro-%d{yyyy-MM-dd_HH}.log</FileNamePattern>
|
|
||||||
<MaxHistory>3</MaxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
<pattern>%d{ISO8601} | %tid | %thread | %-5level | %msg%n</pattern>
|
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||||
</layout>
|
</layout>
|
||||||
</encoder>
|
</encoder>
|
||||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<MaxFileSize>10MB</MaxFileSize>
|
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i.log}</fileNamePattern>
|
||||||
</triggeringPolicy>
|
<maxFileSize>10MB</maxFileSize>
|
||||||
|
<maxHistory>7</maxHistory>
|
||||||
|
<cleanHistoryOnStart>false</cleanHistoryOnStart>
|
||||||
|
</rollingPolicy>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||||
<discardingThreshold>0</discardingThreshold>
|
<discardingThreshold>0</discardingThreshold>
|
||||||
<queueSize>10</queueSize>
|
<queueSize>10</queueSize>
|
||||||
<appender-ref ref="FILE"/>
|
<appender-ref ref="FILE"/>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- skywalking grpc 日志收集 8.4.0版本开始支持 -->
|
<!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 -->
|
||||||
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout">
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout">
|
||||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n</Pattern>
|
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||||
</layout>
|
</layout>
|
||||||
</encoder>s
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<springProfile name="dev">
|
<!-- 本地环境 -->
|
||||||
<logger name="cn.iocoder.dashboard" level="INFO" additivity="false">
|
<springProfile name="local">
|
||||||
|
<logger name="${yudao.info.base-package}" level="INFO" additivity="false">
|
||||||
<appender-ref ref="STDOUT"/>
|
<appender-ref ref="STDOUT"/>
|
||||||
|
<appender-ref ref="GRPC"/>
|
||||||
<appender-ref ref="ASYNC"/>
|
<appender-ref ref="ASYNC"/>
|
||||||
|
<!-- 本地环境下,不打印日志文件 -->
|
||||||
</logger>
|
</logger>
|
||||||
</springProfile>
|
</springProfile>
|
||||||
|
<!-- 其它环境 -->
|
||||||
<springProfile name="local">
|
<springProfile name="default">
|
||||||
<logger name="cn.iocoder.dashboard" level="INFO" additivity="false">
|
<logger name="${yudao.info.base-package}" level="INFO" additivity="false">
|
||||||
<appender-ref ref="STDOUT"/>
|
<appender-ref ref="STDOUT"/>
|
||||||
|
<appender-ref ref="ASYNC"/>
|
||||||
<appender-ref ref="GRPC"/>
|
<appender-ref ref="GRPC"/>
|
||||||
</logger>
|
</logger>
|
||||||
</springProfile>
|
</springProfile>
|
||||||
|
|
||||||
<springProfile name="default">
|
|
||||||
<logger name="cn.iocoder.dashboard" level="INFO" additivity="false">
|
|
||||||
<appender-ref ref="STDOUT"/>
|
|
||||||
<appender-ref ref="ASYNC"/>
|
|
||||||
</logger>
|
|
||||||
</springProfile>
|
|
||||||
|
|
||||||
<root level="INFO">
|
|
||||||
<appender-ref ref="STDOUT"/>
|
|
||||||
<appender-ref ref="ASYNC"/>
|
|
||||||
</root>
|
|
||||||
|
|
||||||
<logger name="cn.iocoder.dashboard" level="INFO">
|
|
||||||
<appender-ref ref="STDOUT"/>
|
|
||||||
</logger>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
Loading…
Reference in New Issue