[logback-user] how to free the logger instance in the loggerCache

David Roussel nabble at diroussel.xsmail.com
Wed Aug 24 18:57:40 UTC 2016


> I saw the loggerCache in class  LoggerContext is a ConcurrentHashMap,  how to free the instance in it.
> 
There doesn’t seem to be a way to clear the cache.  Normally this is not a problem as there is a finite, and small, number of loggers in any application.

What are you trying to do?  And why?

You could suggest a change to logback. Or you could use an ugly reflection hack.  You can change the loggerCache field to public via reflection, then you can get it and clear the entries.  But bewarned this could easily cause problems if you upgrade logback later and don’t test properly.

--
David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20160824/b7103eb0/attachment.html>


More information about the logback-user mailing list