春风项目四线(合箱线、总装线)
yyt
2024-05-23 0ae327c0c3e6bf00e332f231c50a3bcbb0a7fb4c
提交 | 用户 | 时间
fd2207 1 <?xml version="1.0" encoding="UTF-8"?>
2 <configuration>
3     <!-- 日志存放路径 -->
4     <property name="log.path" value="/home/mes/logs" />
5     <!-- 日志输出格式 -->
6     <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
7
8     <!-- 控制台输出 -->
9     <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
10         <encoder>
11             <pattern>${log.pattern}</pattern>
12         </encoder>
13     </appender>
14     
15     <!-- 系统日志输出 -->
16     <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
17         <file>${log.path}/sys-info.log</file>
18         <!-- 循环政策:基于时间创建日志文件 -->
19         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
20             <!-- 日志文件名格式 -->
21             <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
22             <!-- 日志最大的历史 60天 -->
23             <maxHistory>60</maxHistory>
24         </rollingPolicy>
25         <encoder>
26             <pattern>${log.pattern}</pattern>
27         </encoder>
28         <filter class="ch.qos.logback.classic.filter.LevelFilter">
29             <!-- 过滤的级别 -->
30             <level>INFO</level>
31             <!-- 匹配时的操作:接收(记录) -->
32             <onMatch>ACCEPT</onMatch>
33             <!-- 不匹配时的操作:拒绝(不记录) -->
34             <onMismatch>DENY</onMismatch>
35         </filter>
36     </appender>
37     
38     <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
39         <file>${log.path}/sys-error.log</file>
40         <!-- 循环政策:基于时间创建日志文件 -->
41         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
42             <!-- 日志文件名格式 -->
43             <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
44             <!-- 日志最大的历史 60天 -->
45             <maxHistory>60</maxHistory>
46         </rollingPolicy>
47         <encoder>
48             <pattern>${log.pattern}</pattern>
49         </encoder>
50         <filter class="ch.qos.logback.classic.filter.LevelFilter">
51             <!-- 过滤的级别 -->
52             <level>ERROR</level>
53             <!-- 匹配时的操作:接收(记录) -->
54             <onMatch>ACCEPT</onMatch>
55             <!-- 不匹配时的操作:拒绝(不记录) -->
56             <onMismatch>DENY</onMismatch>
57         </filter>
58     </appender>
59     
60     <!-- 用户访问日志输出  -->
61     <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
62         <file>${log.path}/sys-user.log</file>
63         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
64             <!-- 按天回滚 daily -->
65             <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
66             <!-- 日志最大的历史 60天 -->
67             <maxHistory>60</maxHistory>
68         </rollingPolicy>
69         <encoder>
70             <pattern>${log.pattern}</pattern>
71         </encoder>
72     </appender>
73     
74     <!-- 系统模块日志级别控制  -->
75     <logger name="com.jcdm" level="info" />
76     <!-- Spring日志级别控制  -->
77     <logger name="org.springframework" level="warn" />
78
79     <root level="info">
80         <appender-ref ref="console" />
81     </root>
82     
83     <!--系统操作日志-->
84     <root level="info">
85         <appender-ref ref="file_info" />
86         <appender-ref ref="file_error" />
87     </root>
88     
89     <!--系统用户操作日志-->
90     <logger name="sys-user" level="info">
91         <appender-ref ref="sys-user"/>
92     </logger>
93 </configuration>