Source:
private RollingFileHandler(String filename, DataSize maxFileSize, DataSize maxTotalSize, CompressionType compressionType) { requireNonNull(filename, "filename is null"); requireNonNull(maxFileSize, "maxFileSize is null"); requireNonNull(maxTotalSize, "maxTotalSize is null"); requireNonNull(compressionType, "compressionType is null"); this.maxFileSize = maxFileSize.toBytes(); this.compressionType = compressionType; link = Paths.get(filename); thread = new Thread(this::logging); thread.setName("log-writer"); thread.setDaemon(true); setFormatter(new StaticFormatter()); try { MoreFiles.createParentDirectories(link); } catch (IOException e) { throw new UncheckedIOException(e); } try { LegacyRollingFileHandler.recoverTempFiles(filename); } catch (IOException e) { reportError(null, e, OPEN_FAILURE); } if (Files.exists(link)) { try { BasicFileAttributes attributes = Files.readAttributes(link, BasicFileAttributes.class); if (attributes.isRegularFile()) { LocalDateTime createTime = LocalDateTime.ofInstant(attributes.creationTime().toInstant(), ZoneId.systemDefault()).withNano(0); Path logFile = link.resolveSibling(link.getFileName() + DATE_TIME_FORMATTER.format(createTime) + "--" + randomUUID()); Files.move(link, logFile, ATOMIC_MOVE); } } catch (IOException e) { throw new UncheckedIOException("Unable to update move legacy log file to a new file", e); } } tryCleanupTempFiles(link); logHistoryManager = new LogHistoryManager(link, maxTotalSize); try { rollFile(); } catch (IOException e) { throw new UncheckedIOException(e); } if (compressionType != CompressionType.NONE) { compressionExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("log-compression-%d") .build()); } else { compressionExecutor = null; } }

Target:
private RollingFileHandler(String filename, DataSize maxFileSize, DataSize maxTotalSize, CompressionType compressionType) { requireNonNull(filename, "filename is null"); requireNonNull(maxFileSize, "maxFileSize is null"); requireNonNull(maxTotalSize, "maxTotalSize is null"); requireNonNull(compressionType, "compressionType is null"); this.maxFileSize = maxFileSize.toBytes(); this.compressionType = compressionType; symlink = Paths.get(filename); thread = new Thread(this::logging); thread.setName("log-writer"); thread.setDaemon(true); setFormatter(new StaticFormatter()); try { MoreFiles.createParentDirectories(symlink); } catch (IOException e) { throw new UncheckedIOException(e); } try { LegacyRollingFileHandler.recoverTempFiles(filename); } catch (IOException e) { reportError(null, e, OPEN_FAILURE); } if (Files.exists(symlink)) { try { BasicFileAttributes attributes = Files.readAttributes(symlink, BasicFileAttributes.class); if (attributes.isDirectory()) { throw new IllegalArgumentException("Log file is an existing directory: " + filename); } if (attributes.isRegularFile()) { LocalDateTime createTime = LocalDateTime.ofInstant(attributes.creationTime().toInstant(), ZoneId.systemDefault()).withNano(0); Path logFile = symlink.resolveSibling(symlink.getFileName() + DATE_TIME_FORMATTER.format(createTime) + "--" + randomUUID()); Files.move(symlink, logFile, ATOMIC_MOVE); } } catch (IOException e) { throw new UncheckedIOException("Unable to update move legacy log file to a new file", e); } } tryCleanupTempFiles(symlink); historyManager = new LogHistoryManager(symlink, maxTotalSize); try { rollFile(); } catch (IOException e) { throw new UncheckedIOException(e); } if (compressionType != CompressionType.NONE) { compressionExecutor = newSingleThreadExecutor(new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat("log-compression-%d") .build()); } else { compressionExecutor = null; } }