Spring uses commons-logging
which is a logging facade that allows you to write logging code without knowing what is the actual logging framework.
Depending on what you have configured, the commons-logging
will then channel the logging messages to the actual implementation. This allows you to write your code using commons-logging
, and the users to use any logging framework supported by commons-logging
.
Personally I would go with slf4j
(Simple Logging Facade 4 Java) which is similar to commons-logging
, but newer and functions in pretty much the same way.
It's also possible to bridge different libraries or facades, so that even if libraries use different logging frameworks they will always end up in the logger of your choice. Looking to the monitor to my right there are bridge libraries as follows: jcl-over-slf4j
(commons-logging to slf4j), log4j-over-slf4j
and jul-to-slf4j
(java.util.logging to slf4j).
Note: See the link in comments for more information about how slf4j = good, JCL = bad ;)