You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to classpath separation in OSGi based projects, loading of custom Appenders fails with e.g.
log4j:ERROR Could not create an Appender. Reported error follows.
java.lang.ClassNotFoundException: ch.sbb.rcs.common.logging.LazyRollingFileAppender cannot be found by org.apache.log4j_1.2.25
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:541)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:536)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:416)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at org.apache.log4j.helpers.Loader.loadClass(Loader.java:159)
at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:240)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:174)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:189)
at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:492)
at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:415)
at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:932)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:808)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:721)
at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:839)
[...]
I'd suggest to add Eclipse-BuddyPolicy: registered. Then, the issue above is fixed by adding Eclipse-RegisterBuddy: org.apache.log4j to the bundle that provides the custom appender.
The text was updated successfully, but these errors were encountered:
simonzn
added a commit
to simonzn/reload4j
that referenced
this issue
Mar 13, 2024
Adds the buddy policy 'registered' to the
manifest so that custom appenders provided
by OSGi bundles can be loaded via buddy
class loading.
The providing bundle must define a
corresponding Eclipse-RegisterBuddy header.
Closesqos-ch#72
Adds the buddy policy 'registered' to the
manifest so that custom appenders provided
by OSGi bundles can be loaded via buddy
class loading.
The providing bundle must define a
corresponding Eclipse-RegisterBuddy header.
Closesqos-ch#72
simonzn
added a commit
to simonzn/reload4j
that referenced
this issue
Apr 16, 2024
Adds the buddy policy 'registered' to the
manifest so that custom appenders provided
by OSGi bundles can be loaded via buddy
class loading.
The providing bundle must define a
corresponding Eclipse-RegisterBuddy header.
Closesqos-ch#72
Signed-off-by: Simon Zilliken <[email protected]>
Due to classpath separation in OSGi based projects, loading of custom Appenders fails with e.g.
The manifest should define a buddy policy to enable buddy class loading, as described in Context Class Loader Enhancements.
I'd suggest to add
Eclipse-BuddyPolicy: registered
. Then, the issue above is fixed by addingEclipse-RegisterBuddy: org.apache.log4j
to the bundle that provides the custom appender.The text was updated successfully, but these errors were encountered: