<?xml version="1.0" encoding="UTF-8"?>
|
<configuration scan="true">
|
<property name="LOG_TEMP" value="./logs"/>
|
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
<!-- <include resource="org/springframework/boot/logging/logback/base.xml" /> -->
|
<logger name="org.springframework.web" level="INFO"/>
|
<logger name="org.springboot.sample" level="TRACE" />
|
|
<!-- 开发、测试环境 -->
|
<springProfile name="dev,test,prod">
|
<logger name="org.springframework.web" level="INFO"/>
|
<logger name="org.springboot.sample" level="INFO" />
|
<logger name="com.iailab" level="DEBUG" />
|
</springProfile>
|
|
<!-- 生产环境 -->
|
<!--<springProfile name="prod">-->
|
<!--<logger name="org.springframework.web" level="ERROR"/>-->
|
<!--<logger name="org.springboot.sample" level="ERROR" />-->
|
<!--<logger name="io.renren" level="ERROR" />-->
|
<!--</springProfile>-->
|
|
<!-- 日志文件存放路径 -->
|
<property name="log_home" value="./logs" />
|
<!-- 日志输出格式 -->
|
<!--生产用-->
|
<property name="log.pattern" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] | [%thread][%-5level] | [%logger{20}.%method,line : %line] %msg%n" />
|
<!--本地测试使用-->
|
<!--<property name="log.pattern" value="[%boldGreen(%d{yyyy-MM-dd HH:mm:ss.SSS})] | [%highlight(%thread][%-5level)] | [%boldYellow(%logger{20}.%method,%line)] %msg%n" />-->
|
<!-- 日志输出格式【控制台】 -->
|
<!--<property name="log.pattern" value="%date{yyyy-MM-dd HH:mm:ss} | [ line: %line ] | %boldGreen(%thread) | %highlight(%-5level) | %boldYellow(%logger).%method | %msg%n"/>-->
|
|
<!-- 控制台输出 -->
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
<encoder>
|
<!--<pattern>${logPatternConsoleLog}</pattern>-->
|
<pattern>${log.pattern}</pattern>
|
</encoder>
|
</appender>
|
|
<logger name="m-shop-mybatis-sql" level="debug"></logger>
|
|
<!-- debug级别设置 -->
|
<appender name="file_debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<prudent>true</prudent>
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
<!--过滤 DEBUG-->
|
<level>DEBUG</level>
|
<!--匹配到就禁止-->
|
<!--<onMatch>ACCEPT</onMatch>-->
|
<!--没有匹配到就允许-->
|
<!--<onMismatch>DENY</onMismatch>-->
|
</filter>
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
<!--<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">-->
|
<!--日志文件输出的文件名-->
|
<!--<FileNamePattern>${log_home}/log-info.%d{yyyy-MM-dd}.%i.log</FileNamePattern>-->
|
<FileNamePattern>${log_home}/log-debug.%d{yyyy-MM-dd}.log</FileNamePattern>
|
<!--<maxFileSize>100MB</maxFileSize>-->
|
<!-- 日志最大的历史 7天 -->
|
<maxHistory>7</maxHistory>
|
<totalSizeCap>2GB</totalSizeCap>
|
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
</rollingPolicy>
|
<!--<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">-->
|
<!--<!– 单文件最大50MB –>-->
|
<!--<maxFileSize>50MB</maxFileSize>-->
|
<!--</triggeringPolicy>-->
|
<encoder>
|
<pattern>${log.pattern}</pattern>
|
</encoder>
|
</appender>
|
|
<!-- 系统模块日志级别控制 -->
|
<!--<logger name="com.btrh" level="info" />-->
|
|
<!-- Spring日志级别控制 -->
|
<!--<logger name="org.springframework" level="info" />-->
|
|
<!--系统操作日志-->
|
<root level="INFO">
|
<appender-ref ref="console" />
|
<appender-ref ref="file_debug" />
|
</root>
|
|
</configuration>
|