zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
commit | author | age
a18bfa 1 <?xml version="1.0" encoding="UTF-8"?>
Z 2 <configuration debug="false">
3     <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
4     <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
5     <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
6     <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
7     <property name="FILE_LOG_PATTERN" value="${FILE_LOG_PATTERN:-%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
8
9     <property name="LOG_HOME" value="./logs" />
10
11     <springProperty scope="context" name="port" source="server.port"/>
12     <springProperty scope="context" name="appName" source="spring.application.name"/>
13
14     <!-- 控制台输出 -->
15     <appender name="CONSOLE_LOG" class="ch.qos.logback.core.ConsoleAppender">
16         <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
17             <pattern>${CONSOLE_LOG_PATTERN}</pattern>
18         </encoder>
19     </appender>
20
21     <!-- 按照每天生成日志文件 -->
22     <appender name="DEBUG_LOG"
23               class="ch.qos.logback.core.rolling.RollingFileAppender">
24         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
25             <!--     日志文件输出的文件名 -->
26             <FileNamePattern>${LOG_HOME}/${port}/%d{yyyy-MM-dd}/${appName}.log</FileNamePattern>
27             <!-- 日志文件保留天数 -->
28             <MaxHistory>10</MaxHistory>
29         </rollingPolicy>
30         <append>true</append>
31         <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
32             <pattern>${FILE_LOG_PATTERN}</pattern>
33             <charset>utf-8</charset>
34         </encoder>
35     </appender>
36
37
38     <logger name="com.changhong.epc"                                     />
39     <logger name="com.iemsoft.framework"                                 />
40     <logger name="com.changhong.autoform"                                 />
41     <logger name="com.codingapi.tx"                     level="ERROR"    />
42     <logger name="com.ctrip"                             level="ERROR"    />
43     <logger name="com.apache.ibatis"                                     />
44     <logger name="org.apache.http"                        level="ERROR"    />
45     <logger name="java.sql"                                             />
46     <logger name="org.springframework"                     level="INFO"     />
47     <logger name="com.ibatis"                                             />
48     <logger name="java.sql"                                             />
49     <logger name="com.netflix"                            level="ERROR"    />
50
51     <springProfile name="dev">
52         <root level="DEBUG">
53             <appender-ref ref="CONSOLE_LOG" />
54             <appender-ref ref="DEBUG_LOG" />
55         </root>
56     </springProfile>
57
58     <springProfile name="test">
59         <root level="DEBUG">
60             <appender-ref ref="CONSOLE_LOG" />
61             <appender-ref ref="DEBUG_LOG" />
62         </root>
63     </springProfile>
64
65     <springProfile name="formal">
66         <root level="ERROR">
67             <appender-ref ref="CONSOLE_LOG" />
68             <appender-ref ref="DEBUG_LOG" />
69         </root>
70     </springProfile>
71 </configuration>