[ 
https://issues.apache.org/jira/browse/LOG4J2-3230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17462770#comment-17462770
 ] 

Peter Malone commented on LOG4J2-3230:
--------------------------------------

[~jbristow] I'm not using your sample and I have crafted my own for a certain 
use case I'm looking into, but thank you!

[~ggregory] Thanks, I appreciate all you are going through over the last few 
days. Don't let me distract you.

For others interested, I have confirmed that removing the *JndiLookup.class* 
does mitigate for reasons unknown to me. I'm not a log4j developer so I would 
urge caution when reading this.

As advised above, prior to removing JndiLookup we do experience the issue. 

Upon removal we see a NoClassDefFoundError followed by a logging message with 
the ThreadContext configuration value printed.
{code:java}
2021-12-20 12:54:41,104 main ERROR Unable to create Lookup for upper 
java.lang.NoClassDefFoundError: org/apache/logging/log4j/core/lookup/JndiLookup
    at 
org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:81)
    at 
org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:631)
    at 
org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:243)
    at 
org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:289)
    at 
org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:626)
    at 
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:699)
    at 
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:716)
    at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:270)
    at 
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
    at 
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
    at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
    at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:599)
    at com.test.log4j.TestLog4j.<clinit>(TestLog4j.java:7)

12:54:41.205 [main] INFO  com.test.log4j.TestLog4j ${ctx:EXAMPLE} - test {code}

> Certain strings can cause infinite recursion
> --------------------------------------------
>
>                 Key: LOG4J2-3230
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3230
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.8, 2.8.1, 2.8.2, 2.9.0, 2.9.1, 2.10.0, 2.11.0, 2.11.1, 
> 2.11.2, 2.12.0, 2.12.1, 2.13.0, 2.13.1, 2.13.2, 2.14.0, 2.13.3, 2.14.1, 
> 2.15.0, 2.16.0
>            Reporter: Ross Cohen
>            Assignee: Carter Kozak
>            Priority: Major
>             Fix For: 2.17.0
>
>         Attachments: sample.tar.gz
>
>
> If a string substitution is attempted for any reason on the following string, 
> it will trigger an infinite recursion, and the application will crash: 
> ${${::\-${::\-$${::\-j}}}}.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to