[logback-user] Regarding MaxHistory configuration not worked in logback 1.2.3
prabhu Mahendran
prabhuu161994 at gmail.com
Tue Jul 18 07:19:58 CEST 2017
Hi All,
I have tried to create logfile with respect to below requirment.
1.Create 2 files in which should be have size 100 KB.
2.If size of the 2nd file reaches 100 KB then it should be delete oldest
file and then write the new file.
And i have configured like below.
<appender name="APP_FILE" class="ch.qos.logback.core.
rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.
TimeBasedRollingPolicy">
<fileNamePattern>${org.apache.nifi.bootstrap.config.log.dir}
/logfile_%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.
rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100KB</maxFileSize>
<maxHistory>2</maxHistory>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd}T%d{HH:mm:ss.SSS} %msg%n</pattern>
</encoder>
</appender>
With help of above configuration i can create logfile with size 100 KB but
maxHistory not worked.It always create new file if size exceeds 100KB.
I am using logback-core 1.2.3.
Can anyone help me to achieve my requirment?
Am i missed anythink?
Thanks,
prabhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20170718/e9b9e828/attachment.html>
More information about the logback-user
mailing list