You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

114 lines
5.4 KiB

<?xml version="1.0" encoding="UTF-8"?>
<included>
<property name="LOG_HOME" value="logs"/>
<conversionRule conversionWord="hostIp" converterClass="awesome.group.game.service.common.log.IPLogConfig"/>
<springProperty scope="context" name="springAppName" source="spring.application.name"/>
<property name="ENCODER_PATTERN"
value="[%level][%d{yyyy-MM-dd HH:mm:ss}][%t][${springAppName:-}][%X{X-B3-TraceId:-}][%X{X-B3-SpanId:-}][%X{X-B3-ParentSpanId:-}][%hostIp][%logger{5}] - %msg%n"/>
<!-- 文件日志:输出全部日志到文件 -->
<appender name="OUTPUT_FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<file>${LOG_HOME}/biz.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/biz.log.%d{yyyyMMddHH}</fileNamePattern>
<maxHistory>72</maxHistory>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${ENCODER_PATTERN}</pattern>
</encoder>
</appender>
<!-- 异步输出 -->
<appender name="ASYNC_OUTPUT_FILE" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>64</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="OUTPUT_FILE"/>
</appender>
<!--trace log pattern-->
<property name="TRACE_ENCODER_PATTERN"
value="[%level][%d{yyyy-MM-dd HH:mm:ss}][%t][${springAppName:-}][%X{X-B3-TraceId:-}][%X{X-B3-SpanId:-}][%X{X-B3-ParentSpanId:-}][%hostIp][%X{key_action:-}] - %msg%n"/>
<!--trace log 输出文件-->
<appender name="TRACE_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_HOME}/trace.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/trace.log.%d{yyyyMMddHH}</fileNamePattern>
<maxHistory>72</maxHistory>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>${TRACE_ENCODER_PATTERN}</Pattern>
</encoder>
</appender>
<!-- 异步输出 -->
<appender name="ASYNC_TRACE_FILE" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>64</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="TRACE_FILE"/>
</appender>
<!-- api日志-->
<property name="API_ENCODER_PATTERN"
value="[%level][%d{yyyy-MM-dd HH:mm:ss}][%t][${springAppName:-}][%X{key_method_name:-}][%X{X-B3-TraceId:-}][%X{X-B3-SpanId:-}][%X{X-B3-ParentSpanId:-}][%hostIp][%X{key_cost:-}][%X{key_status:-}][%X{key_jwt:-}] - %msg%n"/>
<appender name="API_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_HOME}/api.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/api.log.%d{yyyyMMddHH}</fileNamePattern>
<maxHistory>24</maxHistory>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>${API_ENCODER_PATTERN}</Pattern>
</encoder>
</appender>
<!-- 异步输出 -->
<appender name="ASYNC_API_FILE" class="ch.qos.logback.classic.AsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>64</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="API_FILE"/>
</appender>
<!-- api日志-->
<logger name="log.trace" level="INFO" additivity="false">
<appender-ref ref="ASYNC_TRACE_FILE"/>
</logger>
<logger name="log.api" level="INFO" additivity="false">
<appender-ref ref="ASYNC_API_FILE"/>
</logger>
<logger name="org.apache.catalina.startup.DigesterFactory" level="ERROR"/>
<logger name="org.apache.catalina.util.LifecycleBase" level="ERROR"/>
<logger name="org.apache.coyote.http11.Http11NioProtocol" level="WARN"/>
<logger name="org.apache.sshd.common.util.SecurityUtils" level="WARN"/>
<logger name="org.apache.tomcat.util.net.NioSelectorPool" level="WARN"/>
<logger name="org.eclipse.jetty.util.component.AbstractLifeCycle" level="ERROR"/>
<logger name="org.hibernate.validator.internal.util.Version" level="WARN"/>
<root additivity="false">
<level value="INFO"/>
<appender-ref ref="ASYNC_OUTPUT_FILE"/>
</root>
</included>