diff --git a/util/internal/test/src/main/java/org/hibernate/search/util/impl/test/rule/log4j/LogChecker.java b/util/internal/test/src/main/java/org/hibernate/search/util/impl/test/rule/log4j/LogChecker.java index 775fe6a85b9..768d21a0b9a 100644 --- a/util/internal/test/src/main/java/org/hibernate/search/util/impl/test/rule/log4j/LogChecker.java +++ b/util/internal/test/src/main/java/org/hibernate/search/util/impl/test/rule/log4j/LogChecker.java @@ -43,7 +43,8 @@ public void appendFailure(Description description, String newline) { } } - void process(LogEvent event) { + // This must be synchronized to avoid problems when multiple threads issue log events concurrently + synchronized void process(LogEvent event) { if ( expectation.getMaxExpectedCount() == null && expectation.getMinExpectedCount() <= count ) { // We don't care about events anymore, expectations are met and it won't change return;