improve thread-safety
@@ -177,6 +177,7 @@ public class Log4jBridgeHandler extends java.util.logging.Handler implements Pro
}
if (this.installAsLevelPropagator) {
+ synchronized(this) {
@SuppressWarnings("resource") // no need to close the AutoCloseable ctx here
LoggerContext context = LoggerContext.getContext(false);
context.addPropertyChangeListener(this);
@@ -185,6 +186,7 @@ public class Log4jBridgeHandler extends java.util.logging.Handler implements Pro
// be set here, but a call of JUL.readConfiguration() will be done on purpose
this.installAsLevelPropagator = false;
}
+ }
org.apache.logging.log4j.Logger log4jLogger = getLog4jLogger(record);
String msg = julFormatter.formatMessage(record); // use JUL's implementation to get real msg
