Skip to content
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

Prepare for Log4j2 3.0 #521

Open
grgrzybek opened this issue Jun 26, 2023 · 7 comments
Open

Prepare for Log4j2 3.0 #521

grgrzybek opened this issue Jun 26, 2023 · 7 comments
Assignees
Labels

Comments

@grgrzybek
Copy link
Member

https://www.mail-archive.com/[email protected]/msg08284.html

@grgrzybek grgrzybek added the type: new feature New Feature label Jun 26, 2023
@grgrzybek grgrzybek self-assigned this Jun 26, 2023
@grgrzybek grgrzybek changed the title Export Log4j2 3.0 Prepare for Log4j2 3.0 Jul 25, 2023
@wborn
Copy link
Contributor

wborn commented Sep 27, 2023

Do the preparations also include fixing the "The use of package scanning to locate plugins is deprecated and will be removed in a future release" warnings introduced by LOG4J2-3644 in the PluginManager?

They seem to be caused by the code in the PaxLoggingServiceImpl.

@grgrzybek
Copy link
Member Author

I didn't look at it yet... But scanning and OSGi in the same sentence always give me a headache...

@wborn
Copy link
Contributor

wborn commented Sep 27, 2023

I only saw these warnings while debugging in Eclipse and not in Karaf. Apparently org.ops4j.pax.logging.DefaultServiceLog.level was configured to WARN instead of ERROR which is the Karaf default. I'll raise the log level in Eclipse as well as workaround to suppress these warnings flooding stdout. 🙂

The PluginManager got completely removed in Log4j 3 in favor of using the ServiceLoader mechanism which may also give headaches. 😉

See: https://logging.apache.org/log4j/3.x/

All plugins constructed using Log4j 3.x are now located using Java’s ServiceLoader. This avoids many of the problems users had packaging plugins in "shaded" jars as that technology directly supports ServiceLoader. Plugins constructed using Log4j 2.x will still function in Log4j 3.x.

@splatch
Copy link
Member

splatch commented Sep 27, 2023

I didn't look at it yet... But scanning and OSGi in the same sentence always give me a headache...

According to log4j 3 release message, it works with regular java service locator. And if it works with service locator, we can build a basic bundle tracker to make it work without Aries spi-fly. WDYT?

@mattrpav
Copy link
Member

+1 BundleTracker ftw

@grgrzybek
Copy link
Member Author

Generally +1.

The problem I see is that Log4j3's ServiceLocator locates everything when started/loaded.

In OSGi, if bundle tracker tracks new bundles with plugins in their /META-INF/services we'd probably need to restart entire LogManager. That's of course the same as with SPI-Fly + ServiceLocator...

So in the end +1 to not use SPI-Fly. However I'm too busy this week to think about reloading consequences ;)

@grgrzybek
Copy link
Member Author

FYI, I've just fixed #549 by using Pax Logging's own maven plugin to generate Log4j2Plugins.dat file instead of using deprecated API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants