That should be doable. We can set a ThreadLocal that indicates one of the APIs 
was called and check for it in the other and throw an Exception if it is found. 
Create a Jira issue.

Ralph

> On Apr 11, 2019, at 8:09 AM, Matt Sicker <[email protected]> wrote:
> 
> Yup, too many bridges on the classpath caused an infinite loop. If we
> had a recursion detector similar to AppenderControl (IIRC), that might
> help.
> 
> On Thu, 11 Apr 2019 at 08:38, Carter Kozak <[email protected]> wrote:
>> 
>> Yep, that looks like the failure scenario we've highlighted in red in the 
>> docs.
>> https://logging.apache.org/log4j/2.x/log4j-to-slf4j/index.html
>> 
>> I'm not sure how we would guard against it, arguably failing silently (not 
>> logging) in this case would be worse than throwing.
>> 
>> On Thu, Apr 11, 2019, at 09:24, Gary Gregory wrote:
>>> Have you guys seen this one and is there a way we can guard against it.
>>> 
>>> java.lang.StackOverflowError
>>> at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
>>> at
>>> org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:121)
>>> at
>>> org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
>>> at
>>> org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
>>> at
>>> org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
>>> at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
>>> at
>>> org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
>>> at
>>> org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:37)
>>> at
>>> org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:29)
>>> at
>>> org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:52)
>>> at
>>> org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
>>> at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
>>> at
>>> org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39)
>>> at
>>> org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:37)
>>> at
>>> org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:29)
>>> at
>>> org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:52)
>>> ...
>>> 
>>> Thank you,
>>> Gary
>>> 
> 
> 
> 
> -- 
> Matt Sicker <[email protected]>
> 


Reply via email to