Files
video_server/src/main/resources/logback.xml
2025-01-06 11:38:33 +08:00

46 lines
2.2 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="60 seconds" debug="false">
<contextName>logback</contextName>
<!-- 打印控制台格式 -->
<!--%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<property name="p_console"
value="%green(%d) | %highlight(%-5level) [%thread] %yellow(%c) %cyan([%L]) -| %X{messageId} %msg %n"/>
<!--写入文件格式-->
<property name="p_file" value="%d | %-5level [%thread] %c [%L] -| %X{messageId} %msg %n"/>
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${p_console}</pattern>
</encoder>
</appender>
<!--按天生成日志-->
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/duanju.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--生成日志文件名称-->
<fileNamePattern>logs/%d{yyyy-MM-dd}/duanju.%i.log.gz</fileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<maxFileSize>100MB</maxFileSize>
</rollingPolicy>
<!-- 日志输出格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${p_file}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 配置一些第三方包的日志过滤级别,用于避免刷屏 -->
<!-- 日志级别排序为: TRACE < DEBUG < INFO < WARN < ERROR-->
<!-- WARN [main] org.mybatis.spring.mapper.ClassPathMapperScanner-->
<!-- INFO [main] org.apache.shardingsphere.core.log.ConfigurationLogger-->
<logger name="org.springframework.context.support" level="WARN"/>
<logger name="org.apache.shardingsphere" level="WARN"/>
<logger name="org.mybatis.spring.mapper.ClassPathMapperScanner" level="ERROR"/>
<logger name="com.zaxxer.hikari" level="WARN"/>
<!-- 输出日志 -->
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="logFile"/>
</root>
</configuration>