On 2/26/2012 9:22 AM, Novice wrote:
If so, the next logical step would be to treat all the stuff in the
Common project similarly. If I put all of those classes in package
com.novice.common, then each class would have this:
Logger logger = Logger.getLogger("com.novice.common");
Just as an aside, it's more common to use something like
java.util.logging.Logger.getLogger( getClass().getName() );
instead of a string constant. String constants probably won't be
refactored when a class is renamed or moved to another package. The
above needs no refactoring.
Also:
<http://commons.apache.org/logging/guide.html#Developing%20With%20JCL>
This section points out that it's more efficient to use "static" for the
logger. In desktop apps, that's what I'm used to seeing. However it also
says that "static" interacts poorly with JEE classloaders, so using
instance variables is the norm in JEE (and w/ Tomcat too).