void (@NotNull String testStartMarker, PrintStream out) { Path logFile = getTestLogDir().resolve(LOG_FILE_NAME); if (Files.exists(logFile)) { try { String logText; long length = Files.size(logFile); if (length > LOG_SEEK_WINDOW) { try (RandomAccessFile file = new RandomAccessFile(logFile.toFile(), "r")) { file.seek(length - LOG_SEEK_WINDOW); byte[] bytes = new byte[(int)LOG_SEEK_WINDOW]; int read = file.read(bytes); logText = new String(bytes, 0, read, StandardCharsets.UTF_8); } } else { logText = Files.readString(logFile); } out.println("\n\nIdea Log at " + logFile + ":"); int startPos = logText.lastIndexOf(testStartMarker); out.println(startPos > 0 ? logText.substring(startPos) : logText); } catch (IOException e) { throw new RuntimeException(e); } } }