You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2014/07/15 13:20:58 UTC

svn commit: r1610654 - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java src/changes/changes.xml

Author: ggregory
Date: Tue Jul 15 11:20:58 2014
New Revision: 1610654

URL: http://svn.apache.org/r1610654
Log:
[LOG4J2-703] Android: Could not find class 'javax.naming.InitialContext', referenced from method org.apache.logging.log4j.core.lookup.JndiLookup.lookup. Load the JNDI look up class by name to avoid problems loading the interpolator class on Android.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java?rev=1610654&r1=1610653&r2=1610654&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java (original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java Tue Jul 15 11:20:58 2014
@@ -73,9 +73,10 @@ public class Interpolator implements Str
         lookups.put("sys", new SystemPropertiesLookup());
         lookups.put("env", new EnvironmentLookup());
         try {
-            lookups.put("jndi", new JndiLookup());
-        } catch (Throwable e) {
             // [LOG4J2-703] We might be on Android
+            lookups.put("jndi", (StrLookup) Class.forName("org.apache.logging.log4j.core.lookup.JndiLookup")
+                    .newInstance());
+        } catch (Throwable e) {
             // java.lang.VerifyError: org/apache/logging/log4j/core/lookup/JndiLookup
             LOGGER.warn(
                     "JNDI lookup class is not available because this JRE does not support JNDI. JNDI string lookups will not be available, continuing configuration.",

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1610654&r1=1610653&r2=1610654&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Tue Jul 15 11:20:58 2014
@@ -22,9 +22,12 @@
   </properties>
   <body>
     <release version="?" date="2014-mm-dd" description="?">
-      <action issue="LOG4J2-713" dev="rpopma" type="fix">
+      <action issue="LOG4J2-713" dev="rpopma" type="fix" due-to="Nelson Melina">
         Android: java.lang.VerifyError: org/apache/logging/log4j/core/util/Closer
       </action>
+      <action issue="LOG4J2-703" dev="ggregory" type="fix" due-to="Nelson Melina">
+        Android: Could not find class 'javax.naming.InitialContext', referenced from method org.apache.logging.log4j.core.lookup.JndiLookup.lookup.
+      </action>
     </release> 
     <release version="2.0" date="2014-07-12" description="GA Release">
       <action issue="LOG4J2-705" dev="rpopma" type="fix">
@@ -41,9 +44,6 @@
       <action issue="LOG4J2-441" dev="rgoers" type="fix">
         LoggerConfigs with no Level now inherit the Level from their parent.
       </action>
-      <action issue="LOG4J2-703" dev="ggregory" type="fix" due-to="Nelson Melina">
-        Android: Could not find class 'javax.naming.InitialContext', referenced from method org.apache.logging.log4j.core.lookup.JndiLookup.lookup.
-      </action>
       <action issue="LOG4J2-696" dev="ggregory" type="add">
         RegexFilter does not match multiline log messages.
       </action>