package otcoteam.tahiti.performance.reporter;

import ch.qos.logback.classic.Logger;
import ch.qos.logback.core.rolling.RollingFileAppender;
import ch.qos.logback.core.rolling.TimeBasedRollingPolicy;

/**
 * TODO
 */
public class RollingFileReporter extends LogReporter {

    /**
     * TODO
     */
    protected Logger logger;

    /**
     * TODO
     *
     * @param fileNamePattern
     */
    public RollingFileReporter(String fileNamePattern) {
        RollingFileAppender fileAppender = new RollingFileAppender();
        fileAppender.setContext(getLoggerContext());
        fileAppender.setEncoder(createEncoder());
        fileAppender.start();

        TimeBasedRollingPolicy policy = new TimeBasedRollingPolicy();
        policy.setContext(getLoggerContext());
        policy.setParent(fileAppender);
        policy.setFileNamePattern(fileNamePattern);
        policy.start();

        logger = createLogger();
        logger.addAppender(fileAppender);
    }

    /**
     * TODO
     *
     * @return
     */
    @Override
    public Logger getLogger() {
        return logger;
    }

}

@@ -622,38 +622,8 @@
 ());
-%0A        fileAppender.start();
 %0A%0A  
@@ -829,30 +829,109 @@
 ttern);%0A
-        policy
+%0A        fileAppender.setRollingPolicy(policy);%0A%0A        policy.start();%0A        fileAppender
 .start()

fix log file missing error