Skip to content

Add BND configuration to log4j-1.2-api #1825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 2, 2023
Merged

Conversation

ppkarwasz
Copy link
Contributor

This PR performs the necessary changes to switch log4j-1.2-api from maven-bundle-plugin to bnd-maven-plugin and generate a matching module descriptor.

OSGi descriptor

The import/exports are:

Import-Package
  com.sun.jdmk.comm                      {resolution:=optional}
  javax.jms                              {version=[1.1,3), resolution:=optional}
  javax.management                       
  javax.xml.parsers                      
  javax.xml.transform                    
  javax.xml.transform.stream             
  org.apache.log4j.helpers               
  org.apache.log4j.or                    
  org.apache.logging.log4j.message       {version=[2.21,3)}
  org.apache.logging.log4j.spi           {version=[2.21,3)}
  org.apache.logging.log4j.status        {version=[2.21,3)}
  org.apache.logging.log4j.util          {version=[2.21,3)}
  org.w3c.dom                            
  org.xml.sax                            

Export-Package
  org.apache.log4j                       {version=2.21.0}
  org.apache.log4j.helpers               {version=2.21.0}
  org.apache.log4j.jmx                   {version=2.21.0}
  org.apache.log4j.or                    {version=2.21.0}
  org.apache.log4j.or.jms                {version=2.21.0}
  org.apache.log4j.pattern               {version=2.21.0}
  org.apache.log4j.rewrite               {version=2.21.0}
  org.apache.log4j.spi                   {version=2.21.0}
  org.apache.log4j.varia                 {version=2.21.0}
  org.apache.log4j.xml                   {version=2.21.0}

Remark: unlike the previous versions log4j-1.2-api version 2.21.0-SNAPSHOT only exports those packages, which were present in Log4j 1.x. This is a breaking change. @rgoers, @garydgregory, what do you think?

Module descriptor

module org.apache.log4j@2.21.0.SNAPSHOT {
  requires java.base;
  requires java.desktop;
  requires transitive java.management;
  requires transitive java.xml;
  requires static javax.jms-api;
  requires transitive org.apache.logging.log4j;
  requires static org.apache.logging.log4j.core;
  exports org.apache.log4j;
  exports org.apache.log4j.helpers;
  exports org.apache.log4j.jmx;
  exports org.apache.log4j.or;
  exports org.apache.log4j.or.jms;
  exports org.apache.log4j.pattern;
  exports org.apache.log4j.rewrite;
  exports org.apache.log4j.spi;
  exports org.apache.log4j.varia;
  exports org.apache.log4j.xml;
  opens org.apache.log4j.builders to
    org.apache.logging.log4j.core;
  opens org.apache.log4j.builders.appender to
    org.apache.logging.log4j.core;
  opens org.apache.log4j.builders.filter to
    org.apache.logging.log4j.core;
  opens org.apache.log4j.builders.layout to
    org.apache.logging.log4j.core;
  opens org.apache.log4j.builders.rewrite to
    org.apache.logging.log4j.core;
  opens org.apache.log4j.builders.rolling to
    org.apache.logging.log4j.core;
  opens org.apache.log4j.config to
    org.apache.logging.log4j.core;
}

@ppkarwasz ppkarwasz mentioned this pull request Sep 28, 2023
29 tasks
@ppkarwasz
Copy link
Contributor Author

NB, using the JAR generated in the appropriate log4j-api and log4j-core from #1819 I was able to run a JPMS application that:

  • uses the Log4j 1.x Logger class to log,
  • uses a log4j-properties configuration file.

Differences in the module descriptor:
 * `java.management` is added to the optional requires.

Differences in the OSGi descriptor:
 * the import statement on `sun.reflect` disappears,
 * an import statement on `org.apache.logging.log4j.internal` appears.
@ppkarwasz ppkarwasz merged commit 08bfab5 into apache:bnd Oct 2, 2023
@ppkarwasz ppkarwasz deleted the bnd-1.2-api branch November 21, 2023 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant