private static Path createDir(Path path) {
        File file = path.toFile();
        if (file.exists() && file.canRead() && file.canWrite()) {
            log.log(Level.INFO, "Directory " + path + " already exists");
        } else if (file.mkdirs()) {
            log.log(Level.FINE, () -> "Created " + path);
        } else {
            log.log(Level.WARNING, "Could not create " + path + ", please check permissions");
        }
        return path;
    }
Spooler that will write an entry to a file and read files that are ready to be sent.
Files are written in JSON Lines text file format.

@author hmusum
container-search/src/main/java/com/yahoo/search/logging/Spooler.java