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

Joern Huxhorn (JIRA) noreply-jira at qos.ch
Mon Dec 14 18:06:33 CET 2009


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

Joern Huxhorn commented on LBCLASSIC-172:
-----------------------------------------

Well, what about the level?
If a Logger is created during LoggerContext init then it wouldn't be collected (if kept in e.g. a Set). This should cover both appender and level.
I haven't taken a look at that code, yet, so I might really miss something.

Result of the above code:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:2760)
	at java.util.Arrays.copyOf(Arrays.java:2734)
	at java.util.ArrayList.ensureCapacity(ArrayList.java:167)
	at java.util.ArrayList.add(ArrayList.java:351)
	at ch.qos.logback.classic.Logger.createChildByName(Logger.java:392)
	at ch.qos.logback.classic.LoggerContext.getLogger(LoggerContext.java:148)
	at ch.qos.logback.classic.LoggerContext.getLogger(LoggerContext.java:48)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:249)


> 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