|
|
@ -50,7 +50,6 @@ public abstract class Slf4JLoggingSystem extends AbstractLoggingSystem {
|
|
|
|
public void cleanUp() {
|
|
|
|
public void cleanUp() {
|
|
|
|
if (isBridgeHandlerAvailable()) {
|
|
|
|
if (isBridgeHandlerAvailable()) {
|
|
|
|
removeJdkLoggingBridgeHandler();
|
|
|
|
removeJdkLoggingBridgeHandler();
|
|
|
|
reinstateConsoleHandlerIfNecessary();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -81,17 +80,18 @@ public abstract class Slf4JLoggingSystem extends AbstractLoggingSystem {
|
|
|
|
* @since 2.0.4
|
|
|
|
* @since 2.0.4
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected final boolean isBridgeJulIntoSlf4j() {
|
|
|
|
protected final boolean isBridgeJulIntoSlf4j() {
|
|
|
|
return isBridgeHandlerAvailable() && isJulUsingItsDefaultConfiguration();
|
|
|
|
return isBridgeHandlerAvailable() && isJulUsingASingleConsoleHandlerAtMost();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected final boolean isBridgeHandlerAvailable() {
|
|
|
|
protected final boolean isBridgeHandlerAvailable() {
|
|
|
|
return ClassUtils.isPresent(BRIDGE_HANDLER, getClassLoader());
|
|
|
|
return ClassUtils.isPresent(BRIDGE_HANDLER, getClassLoader());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isJulUsingItsDefaultConfiguration() {
|
|
|
|
private boolean isJulUsingASingleConsoleHandlerAtMost() {
|
|
|
|
Logger rootLogger = LogManager.getLogManager().getLogger("");
|
|
|
|
Logger rootLogger = LogManager.getLogManager().getLogger("");
|
|
|
|
Handler[] handlers = rootLogger.getHandlers();
|
|
|
|
Handler[] handlers = rootLogger.getHandlers();
|
|
|
|
return handlers.length == 1 && handlers[0] instanceof ConsoleHandler;
|
|
|
|
return handlers.length == 0
|
|
|
|
|
|
|
|
|| (handlers.length == 1 && handlers[0] instanceof ConsoleHandler);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void removeJdkLoggingBridgeHandler() {
|
|
|
|
private void removeJdkLoggingBridgeHandler() {
|
|
|
@ -117,11 +117,4 @@ public abstract class Slf4JLoggingSystem extends AbstractLoggingSystem {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void reinstateConsoleHandlerIfNecessary() {
|
|
|
|
|
|
|
|
Logger rootLogger = LogManager.getLogManager().getLogger("");
|
|
|
|
|
|
|
|
if (rootLogger.getHandlers().length == 0) {
|
|
|
|
|
|
|
|
rootLogger.addHandler(new ConsoleHandler());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|