cashier_server/cash-api/order-server/src/main/resources/logback.xml

39 lines
1.7 KiB
XML
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.

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>order-server</contextName>
<property name="log.charset" value="utf-8" />
<property name="log.pattern"
value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) [traceId=%X{traceId:-}, spanId=%X{spanId:-}] - %msg%n" />
<!--写入文件格式-->
<property name="p_file" value="%d [traceId=%X{traceId:-}] | [%thread] %-5level %c [%L] - %msg %n "/>
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!--按天生成日志-->
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/order/logback.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--生成日志文件名称-->
<fileNamePattern>logs/order/history/%d{yyyy-MM-dd}/logback.%i.log.gz</fileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<maxFileSize>20MB</maxFileSize>
</rollingPolicy>
<!-- 日志输出格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${p_file}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!--普通日志输出到控制台-->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="logFile"/>
</root>
</configuration>