Home > Back-end >  Logback by time division, every day to generate a log file, maximum 100 MB per file, every day there
Logback by time division, every day to generate a log file, maximum 100 MB per file, every day there

Time:12-29

Logback by time division, every day to generate a log file, maximum 100 MB per file, every day there will be multiple files, in order to convenient location problem, request log file name accurate to milliseconds, how to configure?

 & lt; Appender name="error - the policy" & gt; 
& lt; The filter & gt;
& lt; Level> ERROR
& lt; OnMatch> ACCEPT
& lt; OnMismatch> DENY
& lt;/filter>
& lt; RollingPolicy & gt;
& lt; FileNamePattern> ${LOG_HOME} {yyyyMMdd}/error/errorLog - % d % d % {HHmmssSSS, aux} - i.l og. Gz
& lt; MaxFileSize> 100 MB & lt;/maxFileSize>
& lt; MaxHistory> 7
& lt; TotalSizeCap> 10 gb & lt;/totalSizeCap>
& lt;/rollingPolicy>
& lt; Encoder>
& lt; Pattern> The ${LOG_PATTERN} & lt;/pattern>
& lt; Charset> The ${CHAR_SET} & lt;/charset>
& lt;/encoder>
& lt;/appender>
& lt; Appender name="error - async" & gt;
& lt; DiscardingThreshold> 0
& lt; QueueSize> 1024 & lt;/queueSize>
& lt; Appender - ref ref="error - the policy"/& gt;
& lt;/appender>
& lt; The logger additivity="true" level="error" name="error - logger" & gt;
& lt; Appender - ref ref="error - async"/& gt;
& lt;/logger>


The above configuration, cannot reach effect

% d {HHmmssSSS, aux} at program startup calculation only once, after the same, until the next day,

ErrorLog - 20201228084732109-0. The gz

ErrorLog - 20201228084732109-1. The log. Gz

ErrorLog - 20201228084732109-2. Log. Gz
  • Related