Skip to content

Commit c3abf96

Browse files
committed
Merge pull request #28495 from Artur-
* pr/28495: Polish "Log the reason that led Devtools to restart the app" Log the reason that led Devtools to restart the app Closes gh-28495
2 parents a0d4651 + b81c004 commit c3abf96

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,9 @@
2020
import java.net.URL;
2121
import java.util.List;
2222

23+
import org.apache.commons.logging.Log;
24+
import org.apache.commons.logging.LogFactory;
25+
2326
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
2427
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
2528
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -94,6 +97,8 @@ LiveReloadServerEventListener liveReloadServerEventListener(OptionalLiveReloadSe
9497
@ConditionalOnProperty(prefix = "spring.devtools.restart", name = "enabled", matchIfMissing = true)
9598
static class RestartConfiguration {
9699

100+
private static final Log restarterLogger = LogFactory.getLog(Restarter.class);
101+
97102
private final DevToolsProperties properties;
98103

99104
RestartConfiguration(DevToolsProperties properties) {
@@ -105,6 +110,10 @@ ApplicationListener<ClassPathChangedEvent> restartingClassPathChangedEventListen
105110
FileSystemWatcherFactory fileSystemWatcherFactory) {
106111
return (event) -> {
107112
if (event.isRestartRequired()) {
113+
if (restarterLogger.isDebugEnabled()) {
114+
restarterLogger.debug(
115+
"Application restart required due to the following changes: " + event.getChangeSet());
116+
}
108117
Restarter.getInstance().restart(new FileWatchingFailureHandler(fileSystemWatcherFactory));
109118
}
110119
};

0 commit comments

Comments
 (0)