avoid null classloader when thread context CL is null#464
avoid null classloader when thread context CL is null#464jackshirazi wants to merge 1 commit intoapache:mainfrom
Conversation
I've seen the config get ignored when thread context classloader is null - if the cl is left at null, the default OneLineFormatter is used instead of the configured formatter
|
I'm curious as to what scenario triggers this issue. It looks like this isn't the only place in JULI that needs to handle this case. I see at least one other place where null isn't handled. Generally, the solution should be consistent with https://github.com/apache/tomcat/blob/main/java/org/apache/juli/ClassLoaderLogManager.java#L400 It may be that some refactoring would be helpful. |
|
Triggered in my case when an agent (in this case Elastic APM agent) was also present, and the agent needs to do classloader manipulation for instrumentation. I suspect I don't see where else in JULI the case is present? In the |
|
For Tomcat |
Fall back to the class loader used to load JULI when the thread context class loader is not set. In a normal Tomcat configuration, this will be the system class loader. Based on a pull request by jackshirazi.
Fall back to the class loader used to load JULI when the thread context class loader is not set. In a normal Tomcat configuration, this will be the system class loader. Based on a pull request by jackshirazi.
Fall back to the class loader used to load JULI when the thread context class loader is not set. In a normal Tomcat configuration, this will be the system class loader. Based on a pull request by jackshirazi.
Fall back to the class loader used to load JULI when the thread context class loader is not set. In a normal Tomcat configuration, this will be the system class loader. Based on a pull request by jackshirazi.
|
Broader patch with refactoring applied. Credit given for your inspiration. |
I've seen the config get ignored when thread context classloader is null - if the cl is left at null, the default OneLineFormatter is used instead of the configured formatter