2021-04-26 09:46:49 +08:00
|
|
|
|
<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 -->
|
2021-03-06 02:03:53 +08:00
|
|
|
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
|
|
|
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
2021-04-26 01:35:05 +08:00
|
|
|
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<pattern>${PATTERN_DEFAULT}</pattern>
|
2021-03-06 02:03:53 +08:00
|
|
|
|
</layout>
|
|
|
|
|
</encoder>
|
|
|
|
|
</appender>
|
2021-04-26 01:35:05 +08:00
|
|
|
|
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<!-- 文件 Appender -->
|
2021-03-06 02:03:53 +08:00
|
|
|
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
|
|
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
|
|
|
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<pattern>${PATTERN_DEFAULT}</pattern>
|
2021-03-06 02:03:53 +08:00
|
|
|
|
</layout>
|
|
|
|
|
</encoder>
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
|
|
|
|
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i.log}</fileNamePattern>
|
|
|
|
|
<maxFileSize>10MB</maxFileSize>
|
|
|
|
|
<maxHistory>7</maxHistory>
|
|
|
|
|
<cleanHistoryOnStart>false</cleanHistoryOnStart>
|
|
|
|
|
</rollingPolicy>
|
2021-03-06 02:03:53 +08:00
|
|
|
|
</appender>
|
|
|
|
|
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
|
|
|
|
<discardingThreshold>0</discardingThreshold>
|
|
|
|
|
<queueSize>10</queueSize>
|
|
|
|
|
<appender-ref ref="FILE"/>
|
|
|
|
|
</appender>
|
2021-04-26 01:35:05 +08:00
|
|
|
|
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 -->
|
2021-04-09 20:32:45 +08:00
|
|
|
|
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
2021-04-26 01:35:05 +08:00
|
|
|
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
|
|
|
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout">
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<pattern>${PATTERN_DEFAULT}</pattern>
|
2021-04-26 01:35:05 +08:00
|
|
|
|
</layout>
|
2021-04-26 09:46:49 +08:00
|
|
|
|
</encoder>
|
2021-04-09 20:32:45 +08:00
|
|
|
|
</appender>
|
2021-03-06 02:03:53 +08:00
|
|
|
|
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<!-- 本地环境 -->
|
2021-03-06 02:03:53 +08:00
|
|
|
|
<springProfile name="local">
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<logger name="${yudao.info.base-package}" level="INFO" additivity="false">
|
2021-03-06 02:03:53 +08:00
|
|
|
|
<appender-ref ref="STDOUT"/>
|
2021-04-09 20:32:45 +08:00
|
|
|
|
<appender-ref ref="GRPC"/>
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<appender-ref ref="ASYNC"/>
|
|
|
|
|
<!-- 本地环境下,不打印日志文件 -->
|
2021-03-06 02:03:53 +08:00
|
|
|
|
</logger>
|
|
|
|
|
</springProfile>
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<!-- 其它环境 -->
|
2021-03-06 02:03:53 +08:00
|
|
|
|
<springProfile name="default">
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<logger name="${yudao.info.base-package}" level="INFO" additivity="false">
|
2021-03-06 02:03:53 +08:00
|
|
|
|
<appender-ref ref="STDOUT"/>
|
|
|
|
|
<appender-ref ref="ASYNC"/>
|
2021-04-26 09:46:49 +08:00
|
|
|
|
<appender-ref ref="GRPC"/>
|
2021-03-06 02:03:53 +08:00
|
|
|
|
</logger>
|
|
|
|
|
</springProfile>
|
|
|
|
|
|
2021-04-26 01:35:05 +08:00
|
|
|
|
</configuration>
|