You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If no logger context exists for a given classloader and configLocation == null the ClassLoaderContextSelector returns the logger context for the parent classloader. This is what happens in most LogManager.getContext calls;
Spring Boot adds a class from the webapp classloader as global filter to the logger context's configuration;
Tomcat calls Logger.isEnabled at the beginning of ClassLoader#loadClass hence it triggers the loading of all classes used by the global filter. This process uses the webapp classloader, hence the recursion.
The text was updated successfully, but these errors were encountered:
I think this problem is more general than you are making it out to be. Anytime there is a sequence of
app-> jul -> log4j -> 3rd party -> jul
there will be an infinite loop. We need to prevent that by detecting recursion in ApiLogger.
In this case, isLoggable should detect the recursion and return false.
ppkarwasz
added
the
bug
Incorrect, unexpected, or unintended behavior of existing code
label
May 23, 2023
Description
Tomcat calls
Logger.isEnabled
at the beginning of itsClassLoader#loadClass
implementation.If the method requires to load additional classes (e.g.
org.apache.logging.log4j.core.Filter.Result
) an infinite recursion occurs.Reproduction
Details
This issue was first reported in this StackOverflow question.
The problem occurs because:
configLocation == null
theClassLoaderContextSelector
returns the logger context for the parent classloader. This is what happens in mostLogManager.getContext
calls;Logger.isEnabled
at the beginning ofClassLoader#loadClass
hence it triggers the loading of all classes used by the global filter. This process uses the webapp classloader, hence the recursion.The text was updated successfully, but these errors were encountered: