Re: [slf4j-user] Is it not safe to store the Logger instance into a static field?

Boris Unckel boris.unckel.mlg at gmx.net
Fri Mar 3 09:13:00 CET 2006


Good Morning,

> Von: "Ruimo Uno" <ruimo.uno at gmail.com>
> Thanks for your great effort to give us these loggig libraries.
> 
> The example code shown here http://www.slf4j.org/manual.html stores
> the Logger instance into a * non-static field *. Is it still harmful to
> store
> the Logger instance into a static field as well as JCL?
I think yes. If you sharing a class via a shared/common classloader
(Tomcat), linked/non-hierarchical classloaders (JBoss, WAS) you will get
problems with static logging fields.
This has nothing to do with statically linked/dynamically linked logging
wrapper but with the TCCL.

Regards
Boris



More information about the slf4j-user mailing list