Skip to content

Commit

Permalink
Merge branch '3.3.x' into 3.4.x
Browse files Browse the repository at this point in the history
Closes gh-43713
  • Loading branch information
wilkinsona committed Jan 7, 2025
2 parents 8502c80 + c7ef3e3 commit b2a271c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ void overrideConfigLocation() {
}

@Test
@ClassPathExclusions("janino-*.jar")
void tryingToUseJaninoWhenItIsNotOnTheClasspathFailsGracefully(CapturedOutput output) {
addPropertiesToEnvironment(this.context, "logging.config=classpath:logback-janino.xml");
void throwableFromInitializeResultsInGracefulFailure(CapturedOutput output) {
System.setProperty(LoggingSystem.SYSTEM_PROPERTY, BrokenInitializationLoggingSystem.class.getName());
multicastEvent(this.listener,
new ApplicationStartingEvent(this.bootstrapContext, new SpringApplication(), NO_ARGS));
assertThatIllegalStateException()
.isThrownBy(() -> this.listener.initialize(this.context.getEnvironment(), this.context.getClassLoader()));
assertThat(output)
.contains("Logging system failed to initialize using configuration from 'classpath:logback-janino.xml'");
assertThat(output).contains("Deliberately broken");
}

@Test
Expand Down Expand Up @@ -712,6 +712,38 @@ public void cleanUp() {

}

static final class BrokenInitializationLoggingSystem extends LoggingSystem {

BrokenInitializationLoggingSystem(ClassLoader classLoader) {

}

@Override
public void beforeInitialize() {
}

@Override
public void initialize(LoggingInitializationContext initializationContext, String configLocation,
LogFile logFile) {
throw new Error("Deliberately broken");
}

@Override
public void setLogLevel(String loggerName, LogLevel level) {
}

@Override
public List<LoggerConfiguration> getLoggerConfigurations() {
return null;
}

@Override
public LoggerConfiguration getLoggerConfiguration(String loggerName) {
return null;
}

}

@Configuration
@Import(WebServerStyleLifecycle.class)
static class TestConfiguration {
Expand Down

This file was deleted.

0 comments on commit b2a271c

Please sign in to comment.