Skip to content

[log4j-to-slf4j] Adapt OSGi metadata to work with slf4j 1 and 2 #1375

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 1 commit into from
Mar 17, 2023

Conversation

HannesWell
Copy link
Contributor

Use the version range [1.7,3) for the imported slf4j packages.
See also https://bnd.bndtools.org/macros/range.html

This changes the generated OSGi Import-Package entries in the MANIFEST.MF from

Import-Package:
 org.apache.logging.log4j;version="[2.20,3)",
 org.apache.logging.log4j.message;version="[2.20,3)",
 org.apache.logging.log4j.spi;version="[2.20,3)",
 org.apache.logging.log4j.status;version="[2.20,3)",
 org.apache.logging.log4j.util;version="[2.20,3)",
 org.slf4j;version="[1.7,2)",
 org.slf4j.spi;version="[1.7,2)"

to

Import-Package:
 org.slf4j;version="[1.7,3)",
 org.slf4j.spi;version="[1.7,3)",
 org.apache.logging.log4j;version="[2.20,3)",
 org.apache.logging.log4j.message;version="[2.20,3)",
 org.apache.logging.log4j.spi;version="[2.20,3)",
 org.apache.logging.log4j.status;version="[2.20,3)",
 org.apache.logging.log4j.util;version="[2.20,3)"

Besides the order, which is irrelevant, only the import package version is changed to [1.7,3) as desired.

I also created a change-log entry as requested by the checklist and hope that is fine.

@ppkarwasz please let me know if any changes are required. Thank you.

Fixes #1232

Checklist

  • Base your changes on 2.x branch if you are targeting Log4j 2; use main otherwise
  • ./mvnw verify succeeds (if it fails due to code formatting issues reported by Spotless, simply run spotless:apply and retry)
  • Changes contain an entry file in the src/changelog/.2.x.x directory
  • Tests for the changes are provided
  • Commits are signed (optional, but highly recommended)

@ppkarwasz
Copy link
Contributor

@HannesWell,

It looks good to me. Can you only rename the changelog file? The convention we use is issue#_comment.xml, in your case 1232_log4j-to-slf4jOSGIMetadata.xml.

@HannesWell
Copy link
Contributor Author

It looks good to me. Can you only rename the changelog file? The convention we use is issue#_comment.xml, in your case 1232_log4j-to-slf4jOSGIMetadata.xml.

Thanks for the hint, I didn't recognize that before. Adjusted the name accordingly.

Use the version range [1.7,3) for the imported slf4j packages.
See also https://bnd.bndtools.org/macros/range.html

Fixes apache#1232

Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
@ppkarwasz ppkarwasz merged commit 5bbfa41 into apache:2.x Mar 17, 2023
@ppkarwasz
Copy link
Contributor

@HannesWell,

Thank you for your contribution, it's merged. When Windows decides to build, a snapshot will be generated.

@HannesWell HannesWell deleted the log4-to-slf4j-2 branch March 17, 2023 14:30
@HannesWell
Copy link
Contributor Author

@HannesWell,

Thank you for your contribution, it's merged. When Windows decides to build, a snapshot will be generated.

Great. Thank you for your quick review.

Out of curiosity, do you already have plans for the next release?

@HannesWell
Copy link
Contributor Author

Another thing, do you think this change should be back-ported to the main branch?

@ppkarwasz
Copy link
Contributor

@HannesWell,

We try to release every 3 months, unless something important comes up. Since the last release is from February 22th, I would expect a release soon.

We'll take care of porting your changes to main, thanks for the reminder.

@HannesWell
Copy link
Contributor Author

Great. Thanks for the info and back-porting. 👍🏽

@HannesWell
Copy link
Contributor Author

HannesWell commented Aug 29, 2023

@HannesWell,

We try to release every 3 months, unless something important comes up. Since the last release is from February 22th, I would expect a release soon.

@ppkarwasz can you give any update about the plan for a 2.20.1 or 2.21.0 release? Thanks in advance.

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.

log4j-to-slf4j not working with slf4j v2
2 participants