I am using rolling file appender in log4j2 and using time based triggering policy. Here is how my configuration file looks like:
...
<RollingFile name="RollingFile" fileName="logs/temp.log" filePattern="logs/test1-%d{MM-dd-yy-HH-mm-ss-SSS}.log">
        <Policies>
            <TimeBasedTriggeringPolicy interval="2"></TimeBasedTriggeringPolicy>
        </Policies>
        <JsonLayout eventEol="true" compact="true"></JsonLayout>
        <CustomStrategy />
</RollingFile>
...
I wrote a class CustomStrategy that extends DefaultRolloverStrategy and then I overrode method rollover as follows:
@Override
public RolloverDescription rollover(final RollingFileManager manager) throws SecurityException {
        RolloverDescription temp = super.rollover(manager);
        //Read file that just got rolled over and do some stuff
        return temp;
    }
In this method I need the name of the file that just got rolled over, i.e. initially logs are written to temp.log which are then rolled over to test1-[some timestamp], to read it and perform certain operations. Can anyone suggest on how to obtain the filename(test1-[some timestamp])?
 
    