Serialized plugin listing files in each active OSGi bundle

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Serialized plugin listing files in each active OSGi bundle

Florian Gehrke

I want to use Log4J2 in my Eclipse 3.7.2 RCP application.

Log4J2 has a problem finding my appender „AppenderTest“. Without running the code in RCP my code worked.

2020-08-14 13:06:29,431 main DEBUG Took 0,221691 seconds to load 0 plugins from package

2020-08-14 13:06:29,440 main ERROR Unable to locate plugin type for AppenderTest

It obviously has problems finding the „plugin“.

In the users guide they explained that the PluginManager locates plugins by looking in five places. The second entry is:

(OSGi only) Serialized plugin listing files in each active OSGi bundle.

Can someone tell me how it is realized? I cannot find any detailed information.



This is my code:

Method in Activator of Eclipse-PlugIn:

private void configureLog4J2() {

            ConfigurationBuilder<BuiltConfiguration> builder = ConfigurationBuilderFactory.newConfigurationBuilder();



            // Add GLP appender


            AppenderComponentBuilder appenderBuilder = builder.newAppender("Appender", "AppenderTest");



            // Add GLP logger

            builder.add(builder.newLogger("").add(builder.newAppenderRef("Appender")).addAttribute("additivity", false));


            // Initialize



Appender class:

@Plugin(name = "AppenderTest", category = "Core", elementType = "appender", printObject = true)

public class AppenderTest extends AbstractAppender {


      private static AppenderTest  instance;


      protected AppenderTest (String name, Filter filter, Layout<? extends Serializable> layout) {

            super(name, filter, layout, false, Property.EMPTY_ARRAY);




      public void append(LogEvent logEvent) {

            // do something




      public static AppenderGlp createAppender(@PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") boolean ignoreExceptions, @PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filters") Filter filter) {

            if(layout == null)

                  layout = PatternLayout.createDefaultLayout();

            instance = new AppenderGlp(name, filter, layout);

            return instance;