At 14:55 30.12.2001 -0600, you wrote:
>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.  

Steve,

Removing the logger from the hashtable is the easier part. You also have to link the 
children of the removed category with its nearest ancestor. 

You would also need to close the appenders of the removed logger but that's something 
that should be done before removing the logger not necessarily within the remove 
method. 

Regards, Ceki

>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