mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish
See gh-36620
This commit is contained in:
parent
3f2c583bd7
commit
5a205dbfd1
@ -151,7 +151,7 @@ public class LoggersEndpoint {
|
|||||||
*/
|
*/
|
||||||
public static class GroupLoggerLevels extends LoggerLevels {
|
public static class GroupLoggerLevels extends LoggerLevels {
|
||||||
|
|
||||||
private List<String> members;
|
private final List<String> members;
|
||||||
|
|
||||||
public GroupLoggerLevels(LogLevel configuredLevel, List<String> members) {
|
public GroupLoggerLevels(LogLevel configuredLevel, List<String> members) {
|
||||||
super(configuredLevel);
|
super(configuredLevel);
|
||||||
@ -165,7 +165,7 @@ public class LoggersEndpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Levels configured for single logger group exposed in a JSON friendly way.
|
* Levels configured for single logger exposed in a JSON friendly way.
|
||||||
*/
|
*/
|
||||||
public static class SingleLoggerLevels extends LoggerLevels {
|
public static class SingleLoggerLevels extends LoggerLevels {
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import org.gradle.util.GradleVersion;
|
|||||||
* <p>
|
* <p>
|
||||||
* To accommodate the differences, we use {@code org.gradle.util.internal.ConfigureUtil}
|
* To accommodate the differences, we use {@code org.gradle.util.internal.ConfigureUtil}
|
||||||
* with Gradle 7.1 and later. With earlier versions, {@code org.gradle.util.ConfigureUtil}
|
* with Gradle 7.1 and later. With earlier versions, {@code org.gradle.util.ConfigureUtil}
|
||||||
* is used. This avoids users by nagged about deprecated API usage in our plugin.
|
* is used. This avoids users to be nagged about deprecated API usage in our plugin.
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
@ -60,7 +60,7 @@ public final class LoggerConfiguration {
|
|||||||
public LoggerConfiguration(String name, LevelConfiguration levelConfiguration,
|
public LoggerConfiguration(String name, LevelConfiguration levelConfiguration,
|
||||||
LevelConfiguration inheritedLevelConfiguration) {
|
LevelConfiguration inheritedLevelConfiguration) {
|
||||||
Assert.notNull(name, "Name must not be null");
|
Assert.notNull(name, "Name must not be null");
|
||||||
Assert.notNull(inheritedLevelConfiguration, "EffectiveLevelConfiguration must not be null");
|
Assert.notNull(inheritedLevelConfiguration, "InheritedLevelConfiguration must not be null");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.levelConfiguration = levelConfiguration;
|
this.levelConfiguration = levelConfiguration;
|
||||||
this.inheritedLevelConfiguration = inheritedLevelConfiguration;
|
this.inheritedLevelConfiguration = inheritedLevelConfiguration;
|
||||||
@ -140,15 +140,15 @@ public final class LoggerConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supported logger configurations scopes.
|
* Supported logger configuration scopes.
|
||||||
*
|
*
|
||||||
* @since 2.7.13
|
* @since 2.7.13
|
||||||
*/
|
*/
|
||||||
public enum ConfigurationScope {
|
public enum ConfigurationScope {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only return configuration that has been applied directly applied. Often
|
* Only return configuration that has been applied directly. Often referred to as
|
||||||
* referred to as 'configured' or 'assigned' configuration.
|
* 'configured' or 'assigned' configuration.
|
||||||
*/
|
*/
|
||||||
DIRECT,
|
DIRECT,
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ package org.springframework.boot.env;
|
|||||||
import org.springframework.boot.testsupport.classpath.ClassPathOverrides;
|
import org.springframework.boot.testsupport.classpath.ClassPathOverrides;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link YamlPropertySourceLoader} with SnakeYAML 1.33.
|
* Tests for {@link YamlPropertySourceLoader} with SnakeYAML 1.32.
|
||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
|
@ -53,10 +53,10 @@ class LoggerConfigurationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void createWithLevelConfigurationWhenEffectiveLevelIsNullThrowsException() {
|
void createWithLevelConfigurationWhenInheritedLevelConfigurationIsNullThrowsException() {
|
||||||
assertThatIllegalArgumentException()
|
assertThatIllegalArgumentException()
|
||||||
.isThrownBy(() -> new LoggerConfiguration("test", null, (LevelConfiguration) null))
|
.isThrownBy(() -> new LoggerConfiguration("test", null, (LevelConfiguration) null))
|
||||||
.withMessage("EffectiveLevelConfiguration must not be null");
|
.withMessage("InheritedLevelConfiguration must not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -166,7 +166,7 @@ class JavaLoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfigurations() {
|
void getLoggerConfigurations() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
this.loggingSystem.initialize(null, null, null);
|
this.loggingSystem.initialize(null, null, null);
|
||||||
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
||||||
@ -176,7 +176,7 @@ class JavaLoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfiguration() {
|
void getLoggerConfiguration() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
this.loggingSystem.initialize(null, null, null);
|
this.loggingSystem.initialize(null, null, null);
|
||||||
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
||||||
|
@ -181,7 +181,7 @@ class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfigurations() {
|
void getLoggerConfigurations() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
this.loggingSystem.initialize(this.initializationContext, null, null);
|
this.loggingSystem.initialize(this.initializationContext, null, null);
|
||||||
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
||||||
@ -191,7 +191,7 @@ class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfigurationsShouldReturnAllLoggers() {
|
void getLoggerConfigurationsShouldReturnAllLoggers() {
|
||||||
LogManager.getLogger("org.springframework.boot.logging.log4j2.Log4J2LoggingSystemTests$Nested");
|
LogManager.getLogger("org.springframework.boot.logging.log4j2.Log4J2LoggingSystemTests$Nested");
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
this.loggingSystem.initialize(this.initializationContext, null, null);
|
this.loggingSystem.initialize(this.initializationContext, null, null);
|
||||||
@ -208,7 +208,7 @@ class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test // gh-35227
|
@Test // gh-35227
|
||||||
void getLoggingConfigurationsWhenHasCustomLevel() {
|
void getLoggerConfigurationWhenHasCustomLevel() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
this.loggingSystem.initialize(this.initializationContext, null, null);
|
this.loggingSystem.initialize(this.initializationContext, null, null);
|
||||||
LoggerContext loggerContext = (LoggerContext) LogManager.getContext(false);
|
LoggerContext loggerContext = (LoggerContext) LogManager.getContext(false);
|
||||||
@ -225,7 +225,7 @@ class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfiguration() {
|
void getLoggerConfiguration() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
this.loggingSystem.initialize(this.initializationContext, null, null);
|
this.loggingSystem.initialize(this.initializationContext, null, null);
|
||||||
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
||||||
@ -235,7 +235,7 @@ class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfigurationShouldReturnLoggerWithNullConfiguredLevel() {
|
void getLoggerConfigurationShouldReturnLoggerWithNullConfiguredLevel() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
this.loggingSystem.initialize(this.initializationContext, null, null);
|
this.loggingSystem.initialize(this.initializationContext, null, null);
|
||||||
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
||||||
@ -244,7 +244,7 @@ class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfigurationForNonExistentLoggerShouldReturnNull() {
|
void getLoggerConfigurationForNonExistentLoggerShouldReturnNull() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
this.loggingSystem.initialize(this.initializationContext, null, null);
|
this.loggingSystem.initialize(this.initializationContext, null, null);
|
||||||
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
||||||
@ -367,7 +367,7 @@ class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfigurationWithResetLevelReturnsNull() {
|
void getLoggerConfigurationWithResetLevelReturnsNull() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
this.loggingSystem.initialize(this.initializationContext, null, null);
|
this.loggingSystem.initialize(this.initializationContext, null, null);
|
||||||
this.loggingSystem.setLogLevel("com.example", LogLevel.WARN);
|
this.loggingSystem.setLogLevel("com.example", LogLevel.WARN);
|
||||||
@ -381,7 +381,7 @@ class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfigurationWithResetLevelWhenAlreadyConfiguredReturnsParentConfiguredLevel() {
|
void getLoggerConfigurationWithResetLevelWhenAlreadyConfiguredReturnsParentConfiguredLevel() {
|
||||||
LoggerContext loggerContext = (LoggerContext) LogManager.getContext(false);
|
LoggerContext loggerContext = (LoggerContext) LogManager.getContext(false);
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
this.loggingSystem.initialize(this.initializationContext, null, null);
|
this.loggingSystem.initialize(this.initializationContext, null, null);
|
||||||
|
@ -213,7 +213,7 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfigurations() {
|
void getLoggerConfigurations() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
initialize(this.initializationContext, null, null);
|
initialize(this.initializationContext, null, null);
|
||||||
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
||||||
@ -223,7 +223,7 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfiguration() {
|
void getLoggerConfiguration() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
initialize(this.initializationContext, null, null);
|
initialize(this.initializationContext, null, null);
|
||||||
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
||||||
@ -233,7 +233,7 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfigurationForLoggerThatDoesNotExistShouldReturnNull() {
|
void getLoggerConfigurationForLoggerThatDoesNotExistShouldReturnNull() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
initialize(this.initializationContext, null, null);
|
initialize(this.initializationContext, null, null);
|
||||||
LoggerConfiguration configuration = this.loggingSystem.getLoggerConfiguration("doesnotexist");
|
LoggerConfiguration configuration = this.loggingSystem.getLoggerConfiguration("doesnotexist");
|
||||||
@ -241,7 +241,7 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getLoggingConfigurationForALL() {
|
void getLoggerConfigurationForALL() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
initialize(this.initializationContext, null, null);
|
initialize(this.initializationContext, null, null);
|
||||||
Logger logger = (Logger) StaticLoggerBinder.getSingleton().getLoggerFactory().getLogger(getClass().getName());
|
Logger logger = (Logger) StaticLoggerBinder.getSingleton().getLoggerFactory().getLogger(getClass().getName());
|
||||||
|
Loading…
Reference in New Issue
Block a user