From c2992e3736eebe061e88b84f087fedd768f70af0 Mon Sep 17 00:00:00 2001 From: Hrishikesh Joshi Date: Thu, 1 Dec 2016 23:35:53 +1100 Subject: [PATCH] Add more debug logging to DevTools Add debug logging for the included and excluded URL patterns and matching URLs. Fixes gh-7478 Closes gh-7544 --- .../boot/devtools/restart/ChangeableUrls.java | 8 ++++++++ .../boot/devtools/settings/DevToolsSettings.java | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ChangeableUrls.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ChangeableUrls.java index 3b43a450ab..7d68419769 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ChangeableUrls.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ChangeableUrls.java @@ -30,6 +30,9 @@ import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.Manifest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.springframework.boot.devtools.settings.DevToolsSettings; import org.springframework.util.StringUtils; @@ -41,6 +44,8 @@ import org.springframework.util.StringUtils; */ final class ChangeableUrls implements Iterable { + private static final Log logger = LogFactory.getLog(ChangeableUrls.class); + private final List urls; private ChangeableUrls(URL... urls) { @@ -52,6 +57,9 @@ final class ChangeableUrls implements Iterable { reloadableUrls.add(url); } } + if (logger.isDebugEnabled()) { + logger.debug("Matching URLs for reloading : " + reloadableUrls); + } this.urls = Collections.unmodifiableList(reloadableUrls); } diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/settings/DevToolsSettings.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/settings/DevToolsSettings.java index 525ab6cd60..332bfeb756 100644 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/settings/DevToolsSettings.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/settings/DevToolsSettings.java @@ -24,6 +24,9 @@ import java.util.List; import java.util.Map; import java.util.regex.Pattern; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.springframework.core.io.UrlResource; import org.springframework.core.io.support.PropertiesLoaderUtils; @@ -40,6 +43,8 @@ public class DevToolsSettings { */ public static final String SETTINGS_RESOURCE_LOCATION = "META-INF/spring-devtools.properties"; + private static final Log logger = LogFactory.getLog(DevToolsSettings.class); + private static DevToolsSettings settings; private final List restartIncludePatterns = new ArrayList(); @@ -105,6 +110,12 @@ public class DevToolsSettings { settings.add(PropertiesLoaderUtils .loadProperties(new UrlResource(urls.nextElement()))); } + if (logger.isDebugEnabled()) { + logger.debug("Included patterns for restart : " + + settings.restartIncludePatterns); + logger.debug("Excluded patterns for restart : " + + settings.restartExcludePatterns); + } return settings; } catch (Exception ex) {