On Wed, 2005-07-27 at 03:16 -0700, Mark Palmer wrote:

> What I need is a way to programatically append to the
> webapps logging context.

Hmm. So given a webapp which might have log4j bundled with it, when that
webapp calls into your code which is deployed
within the container's classpath you want to be able to:
* fetch logger configuration from out of the TCCL
* add objects to it


I think you're into some heavy reflection work there. As you've noticed,
all the objects that the webapp sees have types which are Class objects
as loaded from the webapp's context classloader. So you can't
instantiate objects as normal from your code; they will be of types as
loaded from the container's classloader which aren't compatible.

When calling methods, creating new objects, etc. associated with the
logging stuff you got out of the TCCL you'll always need to use
reflection. Very heavy reflection. I hope this code isn't going to be on
anyone's critical path.

This isn't anything that log4j can do anything about. 

You might want to read a little rant I wrote recently about misusing
classloader hierarchies in containers. It's not entirely relevant to
your current issue but some of it might be useful:
  http://wiki.apache.org/jakarta-commons/Logging/UndeployMemoryLeak

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to