https://issues.apache.org/bugzilla/show_bug.cgi?id=43282
--- Comment #14 from Craig Ziesman <[email protected]> 2010-08-07 21:53:24 EDT --- The specific situation that we had to address was logging via a customized JMSAppender that uses MDC parameters to set header properties in the JMS messages in order to simplify subscriber filtering. We also use a custom Layout class for simulations. When custom appenders or layout classes from a bundle are specified in the Log4j properties/xml file, there is no way to resolve them via Class.forName() in Loader.loadClass() because they aren't on the static class path, and the instantiation fails with a ClassNotFoundException. By modifying Loader.loadClass() to use the bundle context class loader, the OSGi runtime is given the chance to locate the classes in the bundle where they were loaded, and the creation of the logger succeeds. Testing should be fairly straightforward. You would need one or more custom layout and appender classes deployed in a bundle separate from the Log4j bundle. The unit tests would just create and use loggers using those classes. The tests would have to be deployed in a bundle. Knopflerfish and Felix provide JUnit integration to facilitate testing. I don't know about Equinox. We haven't managed to identify any other approaches. Personally, I don't think there is any other way to make this work. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
