On Mon, 4 Feb 2013 11:58:35 +0000, sebb wrote:
On 4 February 2013 11:50, Damjan Jovanovic <dam...@apache.org> 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 "System.out"
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 unnecessary.
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.


Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to