@@ -168,13 +168,13 @@ void overrideConfigLocation() {
168168 }
169169
170170 @ Test
171- @ ClassPathExclusions ("janino-*.jar" )
172- void tryingToUseJaninoWhenItIsNotOnTheClasspathFailsGracefully (CapturedOutput output ) {
173- addPropertiesToEnvironment (this .context , "logging.config=classpath:logback-janino.xml" );
171+ void throwableFromInitializeResultsInGracefulFailure (CapturedOutput output ) {
172+ System .setProperty (LoggingSystem .SYSTEM_PROPERTY , BrokenInitializationLoggingSystem .class .getName ());
173+ multicastEvent (this .listener ,
174+ new ApplicationStartingEvent (this .bootstrapContext , new SpringApplication (), NO_ARGS ));
174175 assertThatIllegalStateException ()
175176 .isThrownBy (() -> this .listener .initialize (this .context .getEnvironment (), this .context .getClassLoader ()));
176- assertThat (output )
177- .contains ("Logging system failed to initialize using configuration from 'classpath:logback-janino.xml'" );
177+ assertThat (output ).contains ("Deliberately broken" );
178178 }
179179
180180 @ Test
@@ -712,6 +712,38 @@ public void cleanUp() {
712712
713713 }
714714
715+ static final class BrokenInitializationLoggingSystem extends LoggingSystem {
716+
717+ BrokenInitializationLoggingSystem (ClassLoader classLoader ) {
718+
719+ }
720+
721+ @ Override
722+ public void beforeInitialize () {
723+ }
724+
725+ @ Override
726+ public void initialize (LoggingInitializationContext initializationContext , String configLocation ,
727+ LogFile logFile ) {
728+ throw new Error ("Deliberately broken" );
729+ }
730+
731+ @ Override
732+ public void setLogLevel (String loggerName , LogLevel level ) {
733+ }
734+
735+ @ Override
736+ public List <LoggerConfiguration > getLoggerConfigurations () {
737+ return null ;
738+ }
739+
740+ @ Override
741+ public LoggerConfiguration getLoggerConfiguration (String loggerName ) {
742+ return null ;
743+ }
744+
745+ }
746+
715747 @ Configuration
716748 @ Import (WebServerStyleLifecycle .class )
717749 static class TestConfiguration {
0 commit comments