private void deleteLogFile(LogFile file) {
        Path path = file.path();
        Path archivePath = file.archivePath();
        try {
            Files.deleteIfExists(path);
        } catch (Exception e) {
            InternalLogger.INSTANCE.error("Caught an error while deleting the log file: "
                    + path, e);
        }
        if (archivePath != null) {
            try {
                Files.deleteIfExists(archivePath);
            } catch (Exception e) {
                InternalLogger.INSTANCE.error("Caught an error while deleting the log file: "
                        + archivePath, e);
            }
        }
    }
Note that it is fine to close file channel and open a new one not atomically because there is
always only one thread will call roll() and append()
turms-server-common/src/main/java/im/turms/server/common/infra/logging/core/appender/file/RollingFileAppender.java