I am developing an RCP application, and I want to use the System.Logger feature (I'm using Java 21) to abstract logger, and use log4j2 as logger implementation.
I am developing an RCP application and want to use the System.Logger. I use the logger feature (Java 21) to abstract the logger and use log4j2 as the logger implementation.
I have several plugins and one of them is used as a "library" plugin: it gathers dependencies from maven (external and local projects) and exports all packages from the different jar files so that libraries are available for all plugins with a dependency to lib plugin.
I use System.Logger in some libraries to log messages, so the library is not dependent on a specific logger implementation (the library's caller makes an implementation choice).
I want to configure a plugin to load the log4j-jpl service so that each call to System.Logger uses log4j instead of the default JUL (if possible).
For now, in my plugins' code, I'm using log4j directly and a custom configuration file to log to the console & file, and it's working fine.
But when the plugin calls a method from a library using System.Logger, the default JUL logger is used, not log4j.
I also tried to use System.Logger directly in the plugin, and the result is the same: log4j-jpl doesn't seem to be seen by the RCP app.
It works fine when using the same library in a Java project (not RCP) with log4j-jpl. So, I guess the problem comes with the context and exposed services of the RCP bundles.
Do you have any suggestions on how to make the log4j-jpl service available to all plugins (and libs) when the RCP app is launched? I couldn't find much documentation on that topic.