Skip to content

Commit 0769b33

Browse files
Artur-snicoll
authored andcommitted
Log the reason that led Devtools to restart the app
See gh-28495
1 parent a0d4651 commit 0769b33

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/classpath/ClassPathFileChangeListener.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
import java.util.Set;
2020

21+
import org.apache.commons.logging.Log;
22+
import org.apache.commons.logging.LogFactory;
23+
2124
import org.springframework.boot.devtools.filewatch.ChangedFile;
2225
import org.springframework.boot.devtools.filewatch.ChangedFiles;
2326
import org.springframework.boot.devtools.filewatch.FileChangeListener;
@@ -35,6 +38,8 @@
3538
*/
3639
class ClassPathFileChangeListener implements FileChangeListener {
3740

41+
private static final Log logger = LogFactory.getLog(ClassPathFileChangeListener.class);
42+
3843
private final ApplicationEventPublisher eventPublisher;
3944

4045
private final ClassPathRestartStrategy restartStrategy;
@@ -60,6 +65,9 @@ class ClassPathFileChangeListener implements FileChangeListener {
6065
@Override
6166
public void onChange(Set<ChangedFiles> changeSet) {
6267
boolean restart = isRestartRequired(changeSet);
68+
if (restart && logger.isDebugEnabled()) {
69+
logger.debug("Restarting dev tools due to changes in the following files: " + changeSet);
70+
}
6371
publishEvent(new ClassPathChangedEvent(this, changeSet, restart));
6472
}
6573

0 commit comments

Comments
 (0)