logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 43282] Add OSGi packaging info to log4j and companions
Date Sun, 08 Aug 2010 01:53:29 GMT

--- Comment #14 from Craig Ziesman <radiofreedenver@gmail.com> 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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message