[INTPAK-199] Karaf log file rotation not using desired file rotation scheme Created: 24/Aug/18  Updated: 25/Sep/18  Resolved: 25/Sep/18

Status: Resolved
Project: integration-packaging
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Victor Pickard Assignee: Victor Pickard
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I used karaf to generate some test logs, via:

opendaylight-user@root>log:load-test --messaged 500000 --threads 10

I monitored the karaf log rotation, as follows:

()[odl@overcloud-controller-2 /var/log/opendaylight]$ while true; do ls -lhrt karaf.lo*; echo; sleep 1; done;

To make it a bit easier to see what was going on, I truncated the karaf.log.1 file to 10 bytes, and karaf.log.2 to 20 bytes.

The expectation is that karaf.log would be rotated to karaf.log1, karaf.log1 would be rotated to karaf.log2, which is referred to as "fixed window strategy"

Reference:
http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender

Take a look at the "Rollover stategies section"

Instead, we see that karaf.log is rotated to karaf.log.2

rw-rr-. 1 odl odl 10 Aug 24 17:52 karaf.log.1
rw-rr-. 1 odl odl 20 Aug 24 17:52 karaf.log.2
rw-rr-. 1 odl odl 997M Aug 24 17:52 karaf.log

rw-rr-. 1 odl odl 10 Aug 24 17:52 karaf.log.1
rw-rr-. 1 odl odl 20 Aug 24 17:52 karaf.log.2
rw-rr-. 1 odl odl 1008M Aug 24 17:52 karaf.log

rw-rr-. 1 odl odl 10 Aug 24 17:52 karaf.log.1
rw-rr-. 1 odl odl 20 Aug 24 17:52 karaf.log.2
rw-rr-. 1 odl odl 1020M Aug 24 17:52 karaf.log

rw-rr-. 1 odl odl 20 Aug 24 17:52 karaf.log.1
rw-rr-. 1 odl odl 1.1G Aug 24 17:53 karaf.log.2
rw-rr-. 1 odl odl 7.7M Aug 24 17:53 karaf.log

The problem is that fileIndex defaults to "max". For the desired behavior, fileIndex should be set to "min".

I have tested a fix, will push a patch shortly.



 Comments   
Comment by Victor Pickard [ 24/Aug/18 ]

https://git.opendaylight.org/gerrit/#/c/75480/

Generated at Wed Feb 07 20:03:53 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.