Merge branch '2.7.x' into 3.0.x

Closes gh-35920
This commit is contained in:
Phillip Webb
2023-06-15 14:08:53 -07:00
7 changed files with 408 additions and 43 deletions

View File

@@ -35,6 +35,7 @@ import org.springframework.boot.actuate.logging.LoggersEndpoint.LoggersDescripto
import org.springframework.boot.actuate.logging.LoggersEndpoint.SingleLoggerLevelsDescriptor;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.logging.LoggerConfiguration;
import org.springframework.boot.logging.LoggerConfiguration.LevelConfiguration;
import org.springframework.boot.logging.LoggerGroups;
import org.springframework.boot.logging.LoggingSystem;
@@ -113,6 +114,17 @@ class LoggersEndpointTests {
assertThat(levels.getEffectiveLevel()).isEqualTo("DEBUG");
}
@Test // gh-35227
void loggerLevelsWhenCustomLevelShouldReturnLevels() {
given(this.loggingSystem.getLoggerConfiguration("ROOT"))
.willReturn(new LoggerConfiguration("ROOT", null, LevelConfiguration.ofCustom("FINEST")));
SingleLoggerLevelsDescriptor levels = (SingleLoggerLevelsDescriptor) new LoggersEndpoint(this.loggingSystem,
this.loggerGroups)
.loggerLevels("ROOT");
assertThat(levels.getConfiguredLevel()).isNull();
assertThat(levels.getEffectiveLevel()).isEqualTo("FINEST");
}
@Test
void groupNameSpecifiedShouldReturnConfiguredLevelAndMembers() {
GroupLoggerLevelsDescriptor levels = (GroupLoggerLevelsDescriptor) new LoggersEndpoint(this.loggingSystem,