Source:
<code>DefaulHttpClientLogger(String filename, int maxHistory, int queueSize, long maxFileSizeInBytes, boolean compressionEnabled) { ContextBase context = new ContextBase(); HttpClientLogLayout httpLogLayout = new HttpClientLogLayout(); recoverTempFiles(filename); RollingFileAppender<HttpRequestEvent> fileAppender = new RollingFileAppender<>(); SizeAndTimeBasedFNATP<HttpRequestEvent> triggeringPolicy = new SizeAndTimeBasedFNATP<>(); TimeBasedRollingPolicy<HttpRequestEvent> rollingPolicy = new TimeBasedRollingPolicy<>(); rollingPolicy.setContext(context); rollingPolicy.setMaxHistory(maxHistory); rollingPolicy.setTimeBasedFileNamingAndTriggeringPolicy(triggeringPolicy); rollingPolicy.setParent(fileAppender); if (compressionEnabled) { <START> rollingPolicy.setFileNamePattern(filename + "-%d{yyyy-MM-dd}.%i.log.gz"); <END> } else { rollingPolicy.setFileNamePattern(filename + "-%d{yyyy-MM-dd}.%i.log"); } triggeringPolicy.setContext(context); triggeringPolicy.setTimeBasedRollingPolicy(rollingPolicy); triggeringPolicy.setMaxFileSize(new FileSize(maxFileSizeInBytes)); fileAppender.setContext(context); fileAppender.setFile(filename); fileAppender.setAppend(true); fileAppender.setBufferSize(BUFFER_SIZE_IN_BYTES); fileAppender.setLayout(httpLogLayout); fileAppender.setRollingPolicy(rollingPolicy); asyncAppender = new AsyncAppenderBase<>(); asyncAppender.setContext(context); asyncAppender.setQueueSize(queueSize); asyncAppender.addAppender(fileAppender); rollingPolicy.start(); triggeringPolicy.start(); fileAppender.start(); asyncAppender.start(); }</code><technical_language>avoid repeating pattern clear this is appending extension? java rollingPolicy.setFileNamePattern(filename + "-%d{yyyy-MM-dd}.%i.log"); if (compressionEnabled) { rollingPolicy.setFileNamePattern(rollingPolicy.getFileNamePattern() + ".gz"); }</technical_language>

Target:
DefaulHttpClientLogger(String filename, int maxHistory, int queueSize, long maxFileSizeInBytes, boolean compressionEnabled) { ContextBase context = new ContextBase(); HttpClientLogLayout httpLogLayout = new HttpClientLogLayout(); recoverTempFiles(filename); RollingFileAppender<HttpRequestEvent> fileAppender = new RollingFileAppender<>(); SizeAndTimeBasedFNATP<HttpRequestEvent> triggeringPolicy = new SizeAndTimeBasedFNATP<>(); TimeBasedRollingPolicy<HttpRequestEvent> rollingPolicy = new TimeBasedRollingPolicy<>(); rollingPolicy.setContext(context); rollingPolicy.setMaxHistory(maxHistory); rollingPolicy.setTimeBasedFileNamingAndTriggeringPolicy(triggeringPolicy); rollingPolicy.setParent(fileAppender); rollingPolicy.setFileNamePattern(filename + "-%d{yyyy-MM-dd}.%i.log"); if (compressionEnabled) { rollingPolicy.setFileNamePattern(rollingPolicy.getFileNamePattern() + ".gz"); } triggeringPolicy.setContext(context); triggeringPolicy.setTimeBasedRollingPolicy(rollingPolicy); triggeringPolicy.setMaxFileSize(new FileSize(maxFileSizeInBytes)); fileAppender.setContext(context); fileAppender.setFile(filename); fileAppender.setAppend(true); fileAppender.setBufferSize(BUFFER_SIZE_IN_BYTES); fileAppender.setLayout(httpLogLayout); fileAppender.setRollingPolicy(rollingPolicy); asyncAppender = new AsyncAppenderBase<>(); asyncAppender.setContext(context); asyncAppender.setQueueSize(queueSize); asyncAppender.addAppender(fileAppender); rollingPolicy.start(); triggeringPolicy.start(); fileAppender.start(); asyncAppender.start(); }