This is an automated email from the ASF dual-hosted git repository. mattsicker pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 1949e6a67b58930ff763f1bdfeaa557fe2019f11 Author: Matt Sicker <[email protected]> AuthorDate: Sun Mar 27 20:23:52 2022 -0500 Add RequiredProperty constraint to JndiLookup This ensures that reflective instantiation of this class has the corresponding system property set. Signed-off-by: Matt Sicker <[email protected]> --- .../java/org/apache/logging/log4j/jndi/lookup/JndiLookup.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/log4j-jndi/src/main/java/org/apache/logging/log4j/jndi/lookup/JndiLookup.java b/log4j-jndi/src/main/java/org/apache/logging/log4j/jndi/lookup/JndiLookup.java index e0e7a5b..d66559d 100644 --- a/log4j-jndi/src/main/java/org/apache/logging/log4j/jndi/lookup/JndiLookup.java +++ b/log4j-jndi/src/main/java/org/apache/logging/log4j/jndi/lookup/JndiLookup.java @@ -16,10 +16,6 @@ */ package org.apache.logging.log4j.jndi.lookup; -import java.util.Objects; - -import javax.naming.NamingException; - import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; @@ -28,12 +24,17 @@ import org.apache.logging.log4j.core.lookup.AbstractLookup; import org.apache.logging.log4j.core.lookup.StrLookup; import org.apache.logging.log4j.jndi.JndiManager; import org.apache.logging.log4j.plugins.Plugin; +import org.apache.logging.log4j.plugins.validation.constraints.RequiredProperty; import org.apache.logging.log4j.status.StatusLogger; +import javax.naming.NamingException; +import java.util.Objects; + /** * Looks up keys from JNDI resources. */ @Plugin(name = "jndi", category = StrLookup.CATEGORY) +@RequiredProperty(name = "log4j2.enableJndiLookup", value = "true", message = "JNDI must be enabled by setting log4j2.enableJndiLookup=true") public class JndiLookup extends AbstractLookup { private static final Logger LOGGER = StatusLogger.getLogger();
