SpringEnvironmentLookup Class — spring-boot Architecture
Architecture documentation for the SpringEnvironmentLookup class in SpringEnvironmentLookup.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/SpringEnvironmentLookup.java lines 36–61
@Plugin(name = "spring", category = StrLookup.CATEGORY)
class SpringEnvironmentLookup implements LoggerContextAware, StrLookup {
private volatile @Nullable Environment environment;
@Override
public @Nullable String lookup(LogEvent event, String key) {
return lookup(key);
}
@Override
public @Nullable String lookup(String key) {
Environment environment = this.environment;
Assert.state(environment != null,
"Unable to obtain Spring Environment from LoggerContext. "
+ "This can happen if your log4j2 configuration filename does not end with '-spring' "
+ "(for example using 'log4j2.xml' instead of 'log4j2-spring.xml')");
return environment.getProperty(key);
}
@Override
public void setLoggerContext(LoggerContext loggerContext) {
this.environment = Log4J2LoggingSystem.getEnvironment(loggerContext);
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free