提交 | 用户 | 时间
|
a6de49
|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
H |
2 |
<configuration scan="true"> |
|
3 |
<property name="LOG_TEMP" value="./logs"/> |
|
4 |
<include resource="org/springframework/boot/logging/logback/defaults.xml" /> |
|
5 |
<!-- <include resource="org/springframework/boot/logging/logback/base.xml" /> --> |
|
6 |
<logger name="org.springframework.web" level="INFO"/> |
|
7 |
<logger name="org.springboot.sample" level="TRACE" /> |
|
8 |
|
|
9 |
<!-- 开发、测试环境 --> |
|
10 |
<springProfile name="dev,test,prod"> |
|
11 |
<logger name="org.springframework.web" level="INFO"/> |
|
12 |
<logger name="org.springboot.sample" level="INFO" /> |
|
13 |
<logger name="com.iailab" level="DEBUG" /> |
|
14 |
</springProfile> |
|
15 |
|
|
16 |
<!-- 生产环境 --> |
|
17 |
<!--<springProfile name="prod">--> |
|
18 |
<!--<logger name="org.springframework.web" level="ERROR"/>--> |
|
19 |
<!--<logger name="org.springboot.sample" level="ERROR" />--> |
|
20 |
<!--<logger name="io.renren" level="ERROR" />--> |
|
21 |
<!--</springProfile>--> |
|
22 |
|
|
23 |
<!-- 日志文件存放路径 --> |
|
24 |
<property name="log_home" value="./logs" /> |
|
25 |
<!-- 日志输出格式 --> |
|
26 |
<!--生产用--> |
|
27 |
<property name="log.pattern" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] | [%thread][%-5level] | [%logger{20}.%method,line : %line] %msg%n" /> |
|
28 |
<!--本地测试使用--> |
|
29 |
<!--<property name="log.pattern" value="[%boldGreen(%d{yyyy-MM-dd HH:mm:ss.SSS})] | [%highlight(%thread][%-5level)] | [%boldYellow(%logger{20}.%method,%line)] %msg%n" />--> |
|
30 |
<!-- 日志输出格式【控制台】 --> |
|
31 |
<!--<property name="log.pattern" value="%date{yyyy-MM-dd HH:mm:ss} | [ line: %line ] | %boldGreen(%thread) | %highlight(%-5level) | %boldYellow(%logger).%method | %msg%n"/>--> |
|
32 |
|
|
33 |
<!-- 控制台输出 --> |
|
34 |
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
|
35 |
<encoder> |
|
36 |
<!--<pattern>${logPatternConsoleLog}</pattern>--> |
|
37 |
<pattern>${log.pattern}</pattern> |
|
38 |
</encoder> |
|
39 |
</appender> |
|
40 |
|
|
41 |
<logger name="m-shop-mybatis-sql" level="debug"></logger> |
|
42 |
|
|
43 |
<!-- debug级别设置 --> |
|
44 |
<appender name="file_debug" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|
45 |
<prudent>true</prudent> |
|
46 |
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|
47 |
<!--过滤 DEBUG--> |
|
48 |
<level>DEBUG</level> |
|
49 |
<!--匹配到就禁止--> |
|
50 |
<!--<onMatch>ACCEPT</onMatch>--> |
|
51 |
<!--没有匹配到就允许--> |
|
52 |
<!--<onMismatch>DENY</onMismatch>--> |
|
53 |
</filter> |
|
54 |
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|
55 |
<!--<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">--> |
|
56 |
<!--日志文件输出的文件名--> |
|
57 |
<!--<FileNamePattern>${log_home}/log-info.%d{yyyy-MM-dd}.%i.log</FileNamePattern>--> |
|
58 |
<FileNamePattern>${log_home}/log-debug.%d{yyyy-MM-dd}.log</FileNamePattern> |
|
59 |
<!--<maxFileSize>100MB</maxFileSize>--> |
|
60 |
<!-- 日志最大的历史 7天 --> |
|
61 |
<maxHistory>7</maxHistory> |
|
62 |
<totalSizeCap>2GB</totalSizeCap> |
|
63 |
<cleanHistoryOnStart>true</cleanHistoryOnStart> |
|
64 |
</rollingPolicy> |
|
65 |
<!--<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">--> |
|
66 |
<!--<!– 单文件最大50MB –>--> |
|
67 |
<!--<maxFileSize>50MB</maxFileSize>--> |
|
68 |
<!--</triggeringPolicy>--> |
|
69 |
<encoder> |
|
70 |
<pattern>${log.pattern}</pattern> |
|
71 |
</encoder> |
|
72 |
</appender> |
|
73 |
|
|
74 |
<!-- 系统模块日志级别控制 --> |
|
75 |
<!--<logger name="com.btrh" level="info" />--> |
|
76 |
|
|
77 |
<!-- Spring日志级别控制 --> |
|
78 |
<!--<logger name="org.springframework" level="info" />--> |
|
79 |
|
|
80 |
<!--系统操作日志--> |
|
81 |
<root level="INFO"> |
|
82 |
<appender-ref ref="console" /> |
|
83 |
<appender-ref ref="file_debug" /> |
|
84 |
</root> |
|
85 |
|
|
86 |
</configuration> |