Add static stopLogback() utility method to the LogbackSupport class.

This commit is contained in:
John Blum
2022-09-29 14:49:57 -07:00
parent a1f7d3b564
commit 6f301e4627

View File

@@ -75,6 +75,16 @@ public abstract class LogbackSupport {
requireLoggerContext().putObject(SPRING_BOOT_LOGGING_SYSTEM_CLASS_NAME, new Object());
}
/**
* Properly stops Logback classic.
*
* @see <a href="https://logback.qos.ch/manual/configuration.html#stopContext">Stopping logback-classic</a>
*/
public static void stopLogback() {
resolveLoggerContext()
.ifPresent(LoggerContext::stop);
}
/**
* Resets the state of the SLF4J Logback logging provider and system.
*/