commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles <>
Subject Re: [all] logging practices in Commons components?
Date Mon, 04 Feb 2013 12:56:14 GMT
On Mon, 4 Feb 2013 11:58:35 +0000, sebb wrote:
> On 4 February 2013 11:50, Damjan Jovanovic <> wrote:
>> Hi
>> I see few Commons components do any logging, and net, io and csv 
>> don't
>> even have any dependencies. Is this a recommended practice?
> Low level libraries should generally not do any logging; the calling
> application is responsible for this.

That actually depends on the meaning of "low level".
Also, _allowing_ logging is not the same as _doing_ logging; slf4j
enables the former, and indeed the application chooses to enable or
not the latter.

>> Imaging prints to System.out (!!) instead of logging, and I am
>> wondering if I should add slf4j or log4j2 instead?
> It should not use System.out.
> But nor should it really use logging.
> Errors and warnings should be returned as exceptions or status codes.

This is not sufficient in order to watch the behaviour of moderately
complex code (like in Commons Math). The alternative of adding 
statements is not "developer-friendly".
For truly "low level" (for example, where all methods contain but a few
statements), there is a balance where indeed logging might be 
This is certainly not the case for more "heavy-weight" components.

> Debug logging is different, but should not be enabled by default.

With slf4j, that is the user's choice.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message