From 97264c77dd4f30a70cb899d7d6e9040df9cd3fec Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 26 Nov 2023 12:44:06 +0100 Subject: [PATCH] Consistently log exceptions from TestExecutionListeners at WARN level Prior to this commit, the TestContextManager logged an exception from a TestExecutionListener at WARN level except in prepareTestInstance() where such an exception was logged at ERROR level (except for a skipped exception which is logged at INFO level). For consistency, this commit modifies TestContextManager so that it always logs non-skipped exceptions from TestExecutionListeners at WARN level. Closes gh-31688 --- .../org/springframework/test/context/TestContextManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/test/context/TestContextManager.java b/spring-test/src/main/java/org/springframework/test/context/TestContextManager.java index b53d8e6991..6754b22103 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestContextManager.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestContextManager.java @@ -268,8 +268,8 @@ public class TestContextManager { .formatted(typeName(testExecutionListener), testInstance), ex); } } - else if (logger.isErrorEnabled()) { - logger.error(""" + else if (logger.isWarnEnabled()) { + logger.warn(""" Caught exception while allowing TestExecutionListener [%s] to \ prepare test instance [%s]""" .formatted(typeName(testExecutionListener), testInstance), ex);