I agree with Simon, that all MyFaces projects need to use one logger.
That said, we must assume that application developers using MyFaces
projects will not use the same logger that MyFaces uses. Thus the
logger we use should be pluggable so the application developer can use
one logger for his application and MyFaces. In many ways
commons-logging has worked for both MyFaces and the application
developer. Simon has a case in which it does not.
In my case, I have used commons-logging with Log4J for years in the
applications I distribute and support. The support staff and customers
are trained on how to use and adjust the Log4J configuration and how to
use the log files produced, so any logging changes by MyFaces will be
evaluated in part on the impact to my customers and staff.
Paul Spencer
simon wrote:
On Sun, 2007-12-16 at 12:07 +0100, Bernd Bohmann wrote:
Hello,
i think slf4j is a better alternative for logging compare to
commons-logging. I don't like to start a slf4j vs commons-logging battle.
Just ask google.
I will change the tobago logging to slf4j.
Asking google is a very bad idea in this case. What you get is the
average opinion. And the *average* coder out there is a fool. Even sites
by people claiming to be experts must be treated carefully; he who
shouts loudest, and makes the boldest claims, is not always the wisest.
If you do not care about supporting localised error messages, and do not
intend to use slf4j-specific features like "markers" then the
commons-logging API is the best because it is the simplest.
Note that we are talking about just what API myfaces code should call.
Other implementations than the one from commons can be used; for example
slf4j provides one. Whether the commons-logging implementation is good
can be debated, but there is nothing really wrong with the api - except
*possibly* for localised messages.
If you do care about supporting localised error messages, then I suggest
you keep an eye on this thread:
http://www.nabble.com/Internationalisation-of-log-messages-to14360301.html
Commons-logging deliberately does not support localisation *within* the
logging library, leaving that to the caller. But as raised in that
thread, it is not currently clear that slf4j properly supports
localisation either.
The java.util.logging api does support localisation, but it's not clear
to me that this is in practice useable. The default implementation is
crap, and there are not many alternatives because the api is horrible to
implement.
It would be better if all the myfaces projects agree on some logging
approach; otherwise an app using myfaces-core+myfaces-commons+trinidad
+tobago might need 4 different logging wrappers in the classpath.
Regards,
Simon