Authored by liangyi.chen@yoho.cn

日志优化

@@ -33,13 +33,11 @@ @@ -33,13 +33,11 @@
33 <!-- DEBUG、INFO、WARN、ERROR级别日志 appender --> 33 <!-- DEBUG、INFO、WARN、ERROR级别日志 appender -->
34 <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> 34 <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
35 <file>/Data/logs/yoho-datasync-consumer/debug.log</file> 35 <file>/Data/logs/yoho-datasync-consumer/debug.log</file>
36 - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 36 + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
37 <!-- daily rollover --> 37 <!-- daily rollover -->
38 <fileNamePattern>/Data/logs/yoho-datasync-consumer/archived/debug.%d{yyyy-MM-dd}.%i.log</fileNamePattern> 38 <fileNamePattern>/Data/logs/yoho-datasync-consumer/archived/debug.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
39 - <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">  
40 - <!-- or whenever the file size reaches 100MB -->  
41 - <maxFileSize>${maxFileSize}</maxFileSize>  
42 - </timeBasedFileNamingAndTriggeringPolicy> 39 + <!-- or whenever the file size reaches 100MB -->
  40 + <maxFileSize>${maxFileSize}</maxFileSize>
43 <!-- keep 30 days' worth of history --> 41 <!-- keep 30 days' worth of history -->
44 <maxHistory>${maxHistory}</maxHistory> 42 <maxHistory>${maxHistory}</maxHistory>
45 </rollingPolicy> 43 </rollingPolicy>
@@ -57,15 +55,13 @@ @@ -57,15 +55,13 @@
57 <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> 55 <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
58 <level>INFO</level> 56 <level>INFO</level>
59 </filter> 57 </filter>
60 - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 58 + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
61 <!-- 按天回滚 daily --> 59 <!-- 按天回滚 daily -->
62 <fileNamePattern>/Data/logs/yoho-datasync-consumer/archived/info.%d{yyyy-MM-dd}.%i.log</fileNamePattern> 60 <fileNamePattern>/Data/logs/yoho-datasync-consumer/archived/info.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
63 <!-- 日志最大的保存天数 --> 61 <!-- 日志最大的保存天数 -->
64 <maxHistory>${maxHistory}</maxHistory> 62 <maxHistory>${maxHistory}</maxHistory>
65 - </rollingPolicy>  
66 - <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">  
67 <maxFileSize>${maxFileSize}</maxFileSize> 63 <maxFileSize>${maxFileSize}</maxFileSize>
68 - </triggeringPolicy> 64 + </rollingPolicy>
69 <encoder> 65 <encoder>
70 <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> 66 <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
71 <!-- 设置字符集 --> 67 <!-- 设置字符集 -->
@@ -80,15 +76,13 @@ @@ -80,15 +76,13 @@
80 <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> 76 <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
81 <level>WARN</level> 77 <level>WARN</level>
82 </filter> 78 </filter>
83 - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 79 + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
84 <!-- 按天回滚 daily --> 80 <!-- 按天回滚 daily -->
85 <fileNamePattern>/Data/logs/yoho-datasync-consumer/archived/warn.%d{yyyy-MM-dd}.%i.log</fileNamePattern> 81 <fileNamePattern>/Data/logs/yoho-datasync-consumer/archived/warn.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
86 <!-- 日志最大的保存天数 --> 82 <!-- 日志最大的保存天数 -->
87 <maxHistory>${maxHistory}</maxHistory> 83 <maxHistory>${maxHistory}</maxHistory>
88 - </rollingPolicy>  
89 - <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">  
90 <maxFileSize>${maxFileSize}</maxFileSize> 84 <maxFileSize>${maxFileSize}</maxFileSize>
91 - </triggeringPolicy> 85 + </rollingPolicy>
92 <encoder> 86 <encoder>
93 <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> 87 <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
94 <!-- 设置字符集 --> 88 <!-- 设置字符集 -->
@@ -99,13 +93,10 @@ @@ -99,13 +93,10 @@
99 <!-- 数据检测相关日志 --> 93 <!-- 数据检测相关日志 -->
100 <appender name="DATA_CHECKERROR_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> 94 <appender name="DATA_CHECKERROR_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
101 <file>/Data/logs/yoho-datasync-consumer/datacheck-error.log</file> 95 <file>/Data/logs/yoho-datasync-consumer/datacheck-error.log</file>
102 - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 96 + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
103 <!-- daily rollover --> 97 <!-- daily rollover -->
104 <fileNamePattern>/Data/logs/yoho-datasync-consumer/archived/datacheck-error.%d{yyyy-MM-dd}.%i.log</fileNamePattern> 98 <fileNamePattern>/Data/logs/yoho-datasync-consumer/archived/datacheck-error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
105 - <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">  
106 - <!-- or whenever the file size reaches 100MB -->  
107 - <maxFileSize>${maxFileSize}</maxFileSize>  
108 - </timeBasedFileNamingAndTriggeringPolicy> 99 + <maxFileSize>${maxFileSize}</maxFileSize>
109 <!-- keep 30 days' worth of history --> 100 <!-- keep 30 days' worth of history -->
110 <maxHistory>${maxHistory}</maxHistory> 101 <maxHistory>${maxHistory}</maxHistory>
111 </rollingPolicy> 102 </rollingPolicy>