I have tried below code to write logs based on SizeAndTimeBasedRollingPolicy
.
In that i can able to write files with respect to file size 100KB but not
able to maintain only 2 maxHistory files.It always write new file after
100KB successfully written.
Now i have using NiFI-1.3.0 which having logback version 1.2.3 for core and
classic jars.
<appender name="APP_FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${org.apache.nifi.bootstrap.config.log.dir}/nifi-app_%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>100 KB</maxFileSize>
<!-- keep 30 log files worth of history -->
<maxHistory>2</maxHistory>
<historyAsFileCount>true</historyAsFileCount>
</rollingPolicy>
<encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date %level [%thread] %logger{40} %msg%n</pattern>
</encoder>
</appender>
I have faced like issue that may belongs to below task.
https://jira.qos.ch/browse/LOGBACK-162
I have used NiFi-1.3.0 it only uses logback 1.2.3.
In NiFi i have found one jira for upgrade logback.
https://issues.apache.org/jira/browse/NIFI-3699
I think logback latest version is 1.2.3. Here it seems MaxHistory property
doesn't work.
Am i missing anythink?
Can anyone suggest me to solve this?