Hi, I am using slf4j 1.6.1 and logback 0.9.28 in my project. I enabled jcl-over-slf4j and added the following line to logback.xml:
<logger name="com.google.inject.servlet.GuiceFilter" level="off"/> I noticed (by setting debugger breakpoints) that the logger level initially gets set to OFF but later on when GuiceFilter invokes: Logger.getLogger(GuiceFilter.class.getName()).warning(MULTIPLE_INJECTORS_WARNING); the returned logger has a level of WARN (the default). No one ever sets the level to WARN. JCL's getLogger() uses weak references and I'm guessing that the underlying instance gets GCed before GuiceFilter uses it, and then comes back with the default logging level. Could this be considered a bug in jcl-over-slf4j? If I set a logging level, shouldn't it keep the instance from getting garbage collected? After all, what guarantees that the Logger will stay alive between the time logback.xml is parsed and the first time GuiceFilter gets instantiated? On the flip side I see a possibility for memory leaks. A nice (but possibly complex) solution would be to hold a strong reference to the Logger until the first time it is referenced by user code, then drop the strong reference and leave it up to the application to keep the Logger alive. Is this possible? Thanks, Gili -- View this message in context: http://slf4j.42922.n3.nabble.com/jcl-over-slf4j-configuration-getting-garbage-collected-tp3075998p3075998.html Sent from the slf4j - user mailing list archive at Nabble.com. _______________________________________________ slf4j-user mailing list [email protected] http://qos.ch/mailman/listinfo/slf4j-user
