Skip to content

Commit 0cbe2e6

Browse files
committed
Correct use of static logger in quarkus code
1 parent 7e64426 commit 0cbe2e6

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

test-framework/junit5/src/main/java/io/quarkus/test/junit/AbstractJvmQuarkusTestExtension.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
import java.util.Set;
99

1010
import org.eclipse.microprofile.config.ConfigProvider;
11+
import org.jboss.logging.Logger;
1112
import org.junit.jupiter.api.Nested;
1213
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
1314
import org.junit.jupiter.api.extension.ExecutionCondition;
1415
import org.junit.jupiter.api.extension.ExtensionContext;
1516

1617
import io.quarkus.bootstrap.app.RunningQuarkusApplication;
1718
import io.quarkus.deployment.dev.testing.TestConfig;
18-
import io.quarkus.logging.Log;
19+
import io.quarkus.runner.bootstrap.StartupActionImpl;
1920
import io.quarkus.test.junit.classloading.FacadeClassLoader;
2021
import io.smallrye.config.SmallRyeConfig;
2122

@@ -35,6 +36,8 @@ public class AbstractJvmQuarkusTestExtension extends AbstractQuarkusTestWithCont
3536
protected static final Deque<Class<?>> currentTestClassStack = new ArrayDeque<>();
3637
protected static Class<?> currentJUnitTestClass;
3738

39+
private static final Logger log = Logger.getLogger(StartupActionImpl.class);
40+
3841
// TODO is it nicer to pass in the test class, or invoke the getter twice?
3942
public static Class<? extends QuarkusTestProfile> getQuarkusTestProfile(Class testClass,
4043
ExtensionContext extensionContext) {
@@ -170,27 +173,27 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con
170173

171174
if (isVSCode) {
172175
// Will need https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/2257 and a reconsume by VSCode
173-
Log.error(
176+
log.error(
174177
"Could not read configuration while evaluating whether to run a test. This is a known issue when running tests in the VS Code IDE. To work around the problem, run individual test methods.");
175178
} else if (isMaybeVSCode) {
176179
// Will need https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/2257 and a reconsume by VSCode
177-
Log.error(
180+
log.error(
178181
"Could not read configuration while evaluating whether to run a test. It looks like you're probably running tests with VS Code. This is a known issue when running tests in the VS Code IDE. To work around the problem, run individual test methods.");
179182
} else if (isEclipse) {
180183
// Tracked by https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/2257; fixed in Eclipse 4.37
181-
Log.error(
184+
log.error(
182185
"Could not read configuration while evaluating whether to run a test. This is a known issue when running tests in the Eclipse IDE. To work around the problem, edit the run configuration and add `-uniqueId [engine:junit-jupiter]/[class:"
183186
+ context.getRequiredTestClass().getName()
184187
+ "]` in the program arguments. Running the whole package, or running individual test methods, will also work without any extra configuration.");
185188
} else {
186-
Log.error("Internal error: Could not read configuration while evaluating whether to run "
189+
log.error("Internal error: Could not read configuration while evaluating whether to run "
187190
+ context.getRequiredTestClass()
188191
+ ". Please let the Quarkus team know what you were doing when this error happened.");
189192

190193
}
191-
Log.debug("Underlying exception: " + e);
192-
Log.debug("Thread Context Classloader: " + Thread.currentThread().getContextClassLoader());
193-
Log.debug("The class of the class we use for mapping is " + TestConfig.class.getClassLoader());
194+
log.debug("Underlying exception: " + e);
195+
log.debug("Thread Context Classloader: " + Thread.currentThread().getContextClassLoader());
196+
log.debug("The class of the class we use for mapping is " + TestConfig.class.getClassLoader());
194197
String message = isVSCode || isMaybeVSCode
195198
? "Could not execute test class because it was loaded with the wrong classloader by the VS Code test runner. Try running test methods individually instead."
196199
: isEclipse

0 commit comments

Comments
 (0)