Skip to content

Apache Lucene open-source search software

SOLR-9507: Correctly set MDC values for CoreContainer threads

Alan Woodward5610fd9df2a5
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 333cfb1d32e..d8df854d85b 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -129,6 +129,9 @@ Bug Fixes
* SOLR-9484: The modify collection API should wait for the modified properties to show up in the
cluster state. (Cao Manh Dat, shalin)
+* SOLR-9507: CoreContainer threads now correctly set their MDC logging values
+ (Alan Woodward)
+
Optimizations
----------------------
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 0b996b82c05..0ccf2def179 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -459,6 +459,8 @@ public class CoreContainer {
zkSys.initZooKeeper(this, solrHome, cfg.getCloudConfig());
if(isZooKeeperAware()) pkiAuthenticationPlugin = new PKIAuthenticationPlugin(this, zkSys.getZkController().getNodeName());
+ MDCLoggingContext.setNode(this);
+
ZkStateReader.ConfigData securityConfig = isZooKeeperAware() ? getZkController().getZkStateReader().getSecurityProps(false) : new ZkStateReader.ConfigData(EMPTY_MAP, -1);
initializeAuthorizationPlugin((Map<String, Object>) securityConfig.data.get("authorization"));
initializeAuthenticationPlugin((Map<String, Object>) securityConfig.data.get("authentication"));