I need to register a custom appender with log4j via log4j's XML configuration.
>From what I can gather, what I need is to define a fragment that extends my
log4j bundle so that log4j can resolve to my custom appender. I'm running
Felix
3.0.0.
Felix cannot resolve my appender implementation, which is in a fragment.
log4j:ERROR Could not create an Appender. Reported error follows.
java.lang.ClassNotFoundException: com.abc.log4j.CopyOnLockRollingFileAppender
at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)
at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1685)
To what extent are fragments (un)supported? Does anything below look wrong?
I've created a bundle with my custom appender; the MANIFEST.MF looks something
like this (using Maven bundle plugin):
Manifest-Version: 1.0
Export-Package: com.abc.log4j
Ignore-Package: org.apache.log4j,org.apache.log4j.helpers,java.io,com.
abc.log4j,org.apache.log4j.spi,java.lang
Implementation-Title: log4j
Implementation-Version: 1.0-OSGI-SNAPSHOT
Built-By: rich
Tool: Bnd-0.0.357
Bundle-Name: log4j
Created-By: Apache Maven Bundle Plugin
Implementation-Vendor: ABC Software
Bundle-Vendor: ABC Software
Fragment-Host: org.apache.log4j
Implementation-Vendor-Id: com.abc.arsys
Bundle-Version: 1.0.0.OSGI-SNAPSHOT
Build-Jdk: 1.6.0_20
Bnd-LastModified: 1279563817391
Bundle-ManifestVersion: 2
Bundle-DocURL: http://www.bmc.com/
Bundle-SymbolicName: com.abc.log4j
The appender implementation is located under com.abc.log4j
Any help is greatly appreciated. Totally stuck at this point.