From cce888fa52f5fb343e251a69d5e09d26eee4a813 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Tue, 28 Nov 2023 16:17:31 +0100 Subject: [PATCH] Add some logging to DevModeClient in the case of errors --- test-framework/devmode-test-utils/pom.xml | 4 ++++ .../quarkus/test/devmode/util/DevModeClient.java | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/test-framework/devmode-test-utils/pom.xml b/test-framework/devmode-test-utils/pom.xml index 4311def04cd6e..563f1268f72c9 100644 --- a/test-framework/devmode-test-utils/pom.xml +++ b/test-framework/devmode-test-utils/pom.xml @@ -14,6 +14,10 @@ Quarkus - Test Framework - Dev Mode Test Utils + + org.jboss.logging + jboss-logging + commons-io commons-io diff --git a/test-framework/devmode-test-utils/src/main/java/io/quarkus/test/devmode/util/DevModeClient.java b/test-framework/devmode-test-utils/src/main/java/io/quarkus/test/devmode/util/DevModeClient.java index 82fe2688d8853..cb71d4e0449f6 100644 --- a/test-framework/devmode-test-utils/src/main/java/io/quarkus/test/devmode/util/DevModeClient.java +++ b/test-framework/devmode-test-utils/src/main/java/io/quarkus/test/devmode/util/DevModeClient.java @@ -19,6 +19,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; +import org.jboss.logging.Logger; import io.smallrye.common.os.OS; @@ -26,6 +27,8 @@ public class DevModeClient { private static final long DEFAULT_TIMEOUT = OS.current() == OS.WINDOWS ? 3L : 1L; + private static final Logger LOG = Logger.getLogger(DevModeClient.class); + static long getDefaultTimeout() { return DEFAULT_TIMEOUT; } @@ -180,6 +183,10 @@ public String getHttpResponse(String path, boolean allowError, Supplier resp.set(content); return true; } catch (Exception e) { + LOG.error( + "An error occurred when DevModeClient accessed " + path + + ". It might be a normal testing behavior but logging the exception for information", + e); return false; } }); @@ -206,6 +213,10 @@ public boolean getHttpResponse(String path, int expectedStatus, long timeout, Ti } return false; } catch (Exception e) { + LOG.error( + "An error occurred when DevModeClient accessed " + path + + ". It might be a normal testing behavior but logging the exception for information", + e); return false; } }); @@ -227,6 +238,10 @@ public boolean getStrictHttpResponse(String path, int expectedStatus) { //complete no matter what the response code was return true; } catch (Exception e) { + LOG.error( + "An error occurred when DevModeClient accessed " + path + + ". It might be a normal testing behavior but logging the exception for information", + e); return false; } });