OSGi does interesting things with ClassLoaders. Log4j has to be able to access your plugin when it is configuring. If it isn’t in an accessible ClassLoader it won’t see it. There have been a few people who are using Log4j in an OSGi environment that have helped out with patches from time to time. Perhaps one of them can help out?
Ralph > On Feb 3, 2016, at 6:07 AM, Nipuni Piyabasi Perera <nipuni880...@gmail.com> > wrote: > > Hi, > > I have written a custom appender extending the log4j2 AbstractAppender. But > I am getting a runtime error[1]. I have added the plugin annotation[2] as > per the manual and the custom appender class contains factory method > createAppender() as well. I also have added the package name to > configuration element. > What am I missing here? Appreciate any input on this. > > I have my log4j2.xml file as below: > > <Configuration packages="org.my.custom.http.socket.appender"> > <Appenders> > ... > <Socket name="socket" host="localhost" port="4714"> > <!--PatternLayout pattern="[%d] %5p {%c} - %m%ex%n"/--> > </Socket> > <HTTPSocket name="HTTP_APPENDER" host="localhost" port="8888"> > <------------------------------------- > New Appender > </HTTPSocket> > </Appenders> > <Loggers> > <Root level="info" includeLocation="true"> > ... > <AppenderRef ref="HTTP_APPENDER"/> > </Root> > <Logger name="my.custom.deployer" level="info" additivity="true"> > <AppenderRef ref="socket"/> > </Logger> > </Loggers> > </Configuration> > > > [1] ERROR Appenders contains an invalid element or attribute "HTTPSocket" > [2] @Plugin(name = "HTTPSocket", category = "Core", elementType = "appender", > printObject = true) > > Thanks, > Nipuni > > -- > Nipuni Perera > Software Engineer; WSO2 Inc.; http://wso2.com > Email: nip...@wso2.com > Git hub profile: https://github.com/nipuni > Blog : http://nipunipererablog.blogspot.com/ > Mobile: +94 (71) 5626680 --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org