[slf4j-user] Library best practice

Ceki Gülcü listid at qos.ch
Sun Mar 11 17:12:20 CET 2007


Hi Martin,

At 04:10 PM 3/10/2007, Martin Jericho wrote:

>Q2.  If library classes are indeed supposed to instantiate their own
>Loggers, am I right in assuming that there is to be a Logger for each class,
>rather than one for the library as a whole?  Would it be considered very bad
>practice if there was only one Logger for the whole library, having the name
>of the package rather than a single class?

As Boris mentioned in his previous message, by instantiating one logger per 
class, you get the flexibility of being able to configure each logger 
individually. What is your motivation for wishing to have a single logger 
for the whole library?

>Q3.  I would still like to know the answer to the question I posed a few
>hours ago, which is how the classloader knows at runtime that it should use
>the LoggerFactory from the implementation jar instead of the "dummy" one in
>the API jar.

The "dummy" binder is not included in log4j-api.jar.

Cheers,

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch




More information about the slf4j-user mailing list