[logback-dev] [JIRA] Commented: (LBCLASSIC-172) Use WeakHashMap instead of Hashtable in LoggerContext
Ceki Gulcu (JIRA)
noreply-jira at qos.ch
Mon Dec 14 16:56:33 CET 2009
[ http://jira.qos.ch/browse/LBCLASSIC-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11449#action_11449 ]
Ceki Gulcu commented on LBCLASSIC-172:
--------------------------------------
> This is IMHO a bug since nothing prevents me from using SLF4J that
> way. And I see no reason why WeakHashMap would be a problem, if I look
> at LoggerContext source.
>
> Keep in mind that weak entries are only removed if a
> garbage-collection is performed. They *are* cached until GC. So even
> the relatively costly creation isn't a very valid argument.
The LoggerContext is a stateful object. If it creates a logger, say
La, and configures it in some way, e.g. setting its level, we don't
wish to have that state to disappear even if no one is referencing La.
> 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