[
https://issues.apache.org/jira/browse/LOG4J2-2422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
rswart closed LOG4J2-2422.
--------------------------
Tested using log4j-core-2.11.2-20180828.224911-32.jar. Application now starts
successfully.
I did not see the log message 'Plugin [{}] could not be loaded due to linkage
error.' in my logs, but that could be due to my setup.
Thank you for the quick fix!
> Handle some unchecked exceptions while loading plugins
> ------------------------------------------------------
>
> Key: LOG4J2-2422
> URL: https://issues.apache.org/jira/browse/LOG4J2-2422
> Project: Log4j 2
> Issue Type: Bug
> Components: Plugins
> Affects Versions: 2.8.2
> Reporter: rswart
> Assignee: Gary Gregory
> Priority: Major
> Fix For: 3.0.0, 2.11.2
>
>
> The PluginRegistry handles [ClassNotFoundException
> |[https://i/apache/logging-log4j2/blob/e741549928b2acbcb2d11ad285aa84ee88728e49/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/PluginRegistry.java#L185]|https://github.com/apache/logging-log4j2/blob/e741549928b2acbcb2d11ad285aa84ee88728e49/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/PluginRegistry.java#L185]]
> but does not handle unchecked exceptions like NoClassDefFoundError. As a
> result applications may not start when loading of a plugin fails with an
> unchecked exception.
>
> Here is the scenario we ran into:
>
> We use [logstash-gelf|http://logging.paluch.biz/] in a standardized Tomcat
> docker images to send Java Util Logging (as used by Tomcat) to Graylog. To do
> this we add the logstash-gelf jar to the $CATALINA_HOME/lib directory,
> effectively placing it on Tomcat's common loader classpath. In essence there
> is no log4j involved, but the logstash-gelf jar contains integrations for
> various logging frameworks, including a log4j2 appender.
> When a webapplication that is deployed on this Tomcat instance uses log4j2 as
> logging framework the logstash-gelf appender is found during plugin scanning
> and the PluginRegistry tries to load it (even if the appender is not used in
> the log4j configuration). The logstash-gelf plugin is not loaded via the
> webapplication classloader, but through the parent common loader. It can find
> the plugin class but not the dependent log4j2 classes as they are only on the
> classpath of the webapplication classloader:
>
> {code:java}
> java.lang.NoClassDefFoundError:
> org/apache/logging/log4j/core/appender/AbstractAppender
> {code}
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)