Log the reason that led Devtools to restart the app

See gh-28495
This commit is contained in:
Artur Signell 2021-11-01 09:48:10 +02:00 committed by Stephane Nicoll
parent a0d4651a04
commit 0769b33e2e
1 changed files with 8 additions and 0 deletions

View File

@ -18,6 +18,9 @@ package org.springframework.boot.devtools.classpath;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.devtools.filewatch.ChangedFile;
import org.springframework.boot.devtools.filewatch.ChangedFiles;
import org.springframework.boot.devtools.filewatch.FileChangeListener;
@ -35,6 +38,8 @@ import org.springframework.util.Assert;
*/
class ClassPathFileChangeListener implements FileChangeListener {
private static final Log logger = LogFactory.getLog(ClassPathFileChangeListener.class);
private final ApplicationEventPublisher eventPublisher;
private final ClassPathRestartStrategy restartStrategy;
@ -60,6 +65,9 @@ class ClassPathFileChangeListener implements FileChangeListener {
@Override
public void onChange(Set<ChangedFiles> changeSet) {
boolean restart = isRestartRequired(changeSet);
if (restart && logger.isDebugEnabled()) {
logger.debug("Restarting dev tools due to changes in the following files: " + changeSet);
}
publishEvent(new ClassPathChangedEvent(this, changeSet, restart));
}