As Sanne mentionned in the private email, I had reasons to use non
static logger.
I was basically following the "recommendations" made by slf4j
http://slf4j.org/faq.html#declared_static
Now, they changed their recommendations to a "not sure" approach and I
look like a clown :o)
Consistency is better in this case. If Core does not aim at using non
static loggers, we can fall back to static loggers. Steve?
--
Emmanuel Bernard
http://in.relation.to/Bloggers/Emmanuel |
http://blog.emmanuelbernard.com
|
http://twitter.com/emmanuelbernard
Hibernate Search in Action (
http://is.gd/Dl1)
On Oct 16, 2008, at 06:17, Hardy Ferentschik wrote:
Hi there,
I just wanted to get some opinion on logger creation.
I introduced a LoggerFactory class into Hibernate Search which
allows the creation of Logger instances without having to specify
the class. The idea behind this it coming from this article -
http://www.javaspecialists.co.za/archive/newsletter.do?issue=137
.
However, as Sanne pointed out to me, to use this pattern efficiently
one has to declare the loggers as static. In fact I am so used to
this idiom that I even dit not notice that in Search the loggers are
declared as instance variables.
After looking around a little I found these articles:
*
http://www.slf4j.org/faq.html#declaration_pattern
*
http://wiki.apache.org/jakarta-commons/Logging/StaticLog
Seems there are pro and cons for both approaches. The biggest
drawback of the static approach being the case where the jar is
deployed as shared library which can screw up the log output of the
using applications (even thought there seems to be ways around this).
Now, Hibernate Core seems to use static loggers. Does this mean we
are not concered about the potential drawbacks of this approach?
Should we aim for a consistent usage pattern, even across the
different Hibernate projects? Or do we maybe already have such
guidelines?
--
Hardy
<LoggerFactory.java>_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev