- Path tempDir = Files.createTempDirectory(actualFileName);
- Map<String, List<Path>> allLogs = LogCollector.allLogs();
- for (Entry<String, List<Path>> logEntry : allLogs.entrySet()) {
- Path subFolder = tempDir.resolve(logEntry.getKey());
- Files.createDirectory(subFolder);
- for (Path p : logEntry.getValue()) {
- try {
- Files.copy(p, subFolder.resolve(p.getFileName()));
- } catch (IOException e) {
- LOGGER.error("Could not copy {}", p.toAbsolutePath(), e);
- }
- }
- }
- FileUtils.compressZip(tempDir.toAbsolutePath().toString(), destination);
- FileUtils.delete(tempDir);