Is there a way to clear logger entries from the Hierarchy class's internal
Hashtable?

The issue I am trying to get around deals with the way in which I am
creating loggers for my User object.  The Logger is an instance variable and
is created by: Logger.getLogger( "session." + user + "_" + session ).  The
combination username plus HTTP session id will be pretty unique.  After
looking through the code for LogManager, DefaultLoggerRepository, and
Hierarchy I have seen no place where the loggers are ever cleaned up (once
called they remain in the hierarchy's hashtable, thus preventing garbage
collection).  I am afraid these log4j loggers will in essence become a
memory-leak, "clearable" only when the VM is shutdown.

I understand that in the normal course/usage of log4j this is excatly what
you probably want to happen.  But in my scenario, it can potentially be
pretty detrimental.

Is there something I missed; someway to clear an individual entry from this
hashtable?

If not, looks like I'll have to subclass or edit Hierarchy to add a
removeLogger method.  What additional clean-up type methods should I call on
the Logger in that case?
Logger.removeAllAppenders()?
Any others?

Thanks,
Steve


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

Reply via email to