[ 
https://issues.apache.org/jira/browse/LOG4J2-3640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ralph Goers closed LOG4J2-3640.
-------------------------------

> @Plugin not compatible between 2.x and 3.x
> ------------------------------------------
>
>                 Key: LOG4J2-3640
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3640
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Plugins
>    Affects Versions: 3.0.0
>            Reporter: Rob Spoor
>            Priority: Major
>
> I had an issue with resolving Log4j2 2.19.0 as a module. While I resolved the 
> issue by adding an explicit {{--add-opens}} clause, I still found something 
> that appears to be an issue.
> According to [this 
> comment|https://stackoverflow.com/questions/74592131/maven-log4j-class-not-found#comment131670094_74592131]
>  from [~rgoers], {quote}Plugins should NOT need to be recompiled
> {quote}
> Because of an earlier comment on my question I had tried to use version 
> 3.0.0-SNAPSHOT. That produced some compiler errors. While some were easy 
> enough to solve to be compatible with versions 2.19.0 and 3.0.0-SNAPSHOT, the 
> moved {{@Plugin}} annotation meant I couldn't compile my project for both 
> versions 2.19.0 and 3.0.0-SNAPSHOT. That made me believe that plugins written 
> for 2.19.0 are *not* compatible with 3.0.0.
> I have created a little POC: [https://github.com/robtimus/log4j-compat-test]. 
> This consists of 3 Maven modules:
>  * A module with only a simple plugin
>  * A module to test this plugin in Log4j2 2.19.0
>  * A module to test this plugin in Log4j2 3.0.0-SNAPSHOT
> The entire project can be tested using {{mvn test}}. Right now this fails 
> because, as expected, the moving of the {{@Plugin}} annotation caused the 
> plugin to *not* be resolved.
> I've also included a "legacy" plugin class in the 3.0.0-SNAPSHOT test module 
> that shows that the deprecated annotations 
> {{org.apache.logging.log4j.core.config.plugins.PluginAttribute}} and 
> {{org.apache.logging.log4j.core.config.plugins.PluginFactory}} still work; 
> it's the (forced) replacement of 
> {{org.apache.logging.log4j.core.config.plugins.Plugin}} with both 
> {{org.apache.logging.log4j.plugins.Plugin}} and 
> {{org.apache.logging.log4j.plugins.Configurable}} that causes the plugin 
> written for version 2.19.0 to not work.
> ----
> I think that the following should be done, to prevent forcing people rewrite 
> all of their existing plugins:
>  * Re-adding the {{org.apache.logging.log4j.core.config.plugins.Plugin}} 
> annotation, but make it deprecated.
>  * The plugin registration code should treat this plugin as a combination of 
> {{org.apache.logging.log4j.plugins.Plugin}} and 
> {{{}org.apache.logging.log4j.plugins.Configurable{}}}. There may be another 
> one, for the {{category}} attribute of the old annotation, but I couldn't 
> find out which one yet.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to