vy commented on code in PR #2954: URL: https://github.com/apache/logging-log4j2/pull/2954#discussion_r1794842040
########## log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/TempLoggingDirectory.java: ########## @@ -135,6 +132,29 @@ private PathHolder createLoggingPath(final ExtensionContext context, final Clean return holder; } + private Path determinePerClassPath(ExtensionContext context) { + // Check if the parent context already created a folder + PathHolder holder = ExtensionContextAnchor.getAttribute(PathHolder.class, PathHolder.class, context); + if (holder == null) { + try { + // Create temporary per-class directory + final String baseDir = System.getProperty("basedir"); + final Path basePath = (baseDir != null ? Paths.get(baseDir, "target") : Paths.get(".")).resolve("logs"); + final Class<?> clazz = context.getRequiredTestClass(); + final Package pkg = clazz.getPackage(); + final String dir = + pkg.getName().replaceAll("[.$]", File.separatorChar == '\\' ? "\\\\" : File.separator); + // Create a temporary directory that uses the simple class name as prefix + Path packagePath = basePath.resolve(dir); + Files.createDirectories(packagePath); + return Files.createTempDirectory(packagePath, clazz.getSimpleName()); Review Comment: > Aren't those reruns happening inside the same JVM? No, I am triggering it myself manually: `./mvnw test ...`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org