maxHistory of Multiple %d specifiers in logback Ti

2019-07-31 19:56发布

问题:

In logback xml

<appender name="REQUEST_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${REQUEST_LOG_DIR}/request_${server.ip}_${server.port}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  <!-- minute rollover -->
  <fileNamePattern>${REQUEST_LOG_DIR}/request_archives/%d{yyyy-MM-dd,aux}/ip_${server.ip}/port_${server.port}/request_%d{yyyy-MM-dd_HH-mm}.log</fileNamePattern>
  <!-- 24 * 7 * 60, keep last 7 days history -->
  <maxHistory>10080</maxHistory>
</rollingPolicy>
<encoder>
  <pattern>%msg%n</pattern>
</encoder>

i want to keep 7 days log,but it don't work.And i try the following,but still not work:

<!-- minute rollover -->
  <fileNamePattern>${REQUEST_LOG_DIR}/request_archives/%d{yyyy-MM-dd}/ip_${server.ip}/port_${server.port}/request_%d{yyyy-MM-dd_HH-mm,aux}.log</fileNamePattern>
  <!-- keep last 7 days history -->
  <maxHistory>7</maxHistory>
标签: java logback