[logback-dev] [JIRA] Issue Comment Edited: (LBCLASSIC-172) Use WeakHashMap instead of Hashtable in LoggerContext

Joern Huxhorn (JIRA) noreply-jira at qos.ch
Tue Dec 15 14:34:33 CET 2009


    [ http://jira.qos.ch/browse/LBCLASSIC-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11462#action_11462 ] 

Joern Huxhorn edited comment on LBCLASSIC-172 at 12/15/09 2:34 PM:
-------------------------------------------------------------------

Oh dear, now I understand the problem.

I wasn't aware that Loggers can be configured outside of LoggerContext. I've never done something like this.
This makes the whole issue a lot more complex than I thought.
It's solvable but rather complex - the state of a logger would need to be handled detached from the Logger itself.
Urgs.
I agree that this isn't simply an issue of WeakHashMap vs Hashtable. Solving this issue at *some* time should be kept in mind, though.
Just for the sake of completeness: is there any other state beside level and appenders?

And yes, Holger is right about SoftReferences.

      was (Author: jhuxhorn):
    Oh dear, now I understand the problem.

I wasn't aware that Loggers can be configured outside of LoggerContext. I've never done something like this.
This makes the whole issue a lot more complexbthan I thought.
It's solvable but rather complex - the state of a logger would need to be handled detached from the Logger itself.
Urgs.
I agree that this isn't simply an issue of WeakHashMap vs Hashtable. Solving this issue at *some* time should be kept in mind, though.
Just for the sake of completeness: is there any other state beside level and appenders?

And yes, Holger is right about SoftReferences.
  
> Use WeakHashMap instead of Hashtable in LoggerContext
> -----------------------------------------------------
>
>                 Key: LBCLASSIC-172
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-172
>             Project: logback-classic
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 0.9.18
>            Reporter: Joern Huxhorn
>            Assignee: Logback dev list
>             Fix For: unspecified
>
>
> Preventing garbage-collection of unused Loggers is a bad idea. 
> The following code should not fail:
> for(int i=0;i<10000000;i++) {
>   LoggerFactory.getLogger("Foo."+i).debug("Foo!");
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list