PDA

View Full Version : Usage of Log members in Spring source



therring
Mar 7th, 2005, 03:14 PM
Why does the Spring source code create org.apache.commons.logging.Log variables as class members rather than as static? The reason that I ask is that the commons-logging documentation recommends that it be created as static. I realize that most objects in Spring are only created one time... so the impact is virtually zero.

Just an observation... any thoughts?

Alef Arendsen
Mar 8th, 2005, 01:19 AM
I know that for some, the advantage is that logging using the log member of superclassses in a subclass causes the log statement to be associated with this class, instead of the class it's been defined in. In code using the jdbc infrastructural code, this is pretty handy.