File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
core/spring-boot/src/test/java/org/springframework/boot/logging/log4j2 Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 3737import org .apache .logging .log4j .core .LoggerContext ;
3838import org .apache .logging .log4j .core .config .Configuration ;
3939import org .apache .logging .log4j .core .config .LoggerConfig ;
40+ import org .apache .logging .log4j .core .config .Reconfigurable ;
4041import org .apache .logging .log4j .core .config .composite .CompositeConfiguration ;
4142import org .apache .logging .log4j .core .config .plugins .util .PluginRegistry ;
4243import org .apache .logging .log4j .core .config .xml .XmlConfiguration ;
@@ -114,6 +115,15 @@ void setup(TestInfo testInfo) {
114115 @ AfterEach
115116 void cleanUp () {
116117 this .loggingSystem .cleanUp ();
118+ LoggerContext loggerContext = (LoggerContext ) LogManager .getContext (false );
119+ Configuration configuration = loggerContext .getConfiguration ();
120+ loggerContext .stop ();
121+ if (configuration instanceof Reconfigurable reconfigurable ) {
122+ loggerContext .start (reconfigurable .reconfigure ());
123+ }
124+ else {
125+ loggerContext .start (configuration );
126+ }
117127 PluginRegistry .getInstance ().clear ();
118128 }
119129
You can’t perform that action at this time.
0 commit comments