> -----Original Message----- > From: Harald Ommang [mailto:[EMAIL PROTECTED] > Subject: Re: Loggers in API Components > On Tue, 10 Jan 2006 14:39:23 +0100 > Manfred Geiler <[EMAIL PROTECTED]> wrote: > >>> facesContext.getExternalContext().log(); > > And, of course, it will be too late. Because, when JSF 2.x > is out, we > >will already have thousands of commons-logging calls in our code. ;-) > Would it not be infinitely better to create a thin MyFaces > internal wrapper around Commons Logging, to keep the > dependency in a single place, instead of thousands...?
I'm much against creating yet another wrapper over logging systems. I think we have enough already. The problem is how to get everybody to consistently use your newly introduced wrapper and not to mention somebody eventually adding things into this custom wrapper layer that shouldn't be part of it. > Regarding Commons Logging, take a look at this article: > http://www.qos.ch/logging/thinkAgain.jsp. > The article is from 2002, but I assume many of the > arguments are still valid. With all of its faults, commons-logging is created exactly for this purpose; to allow third-party libraries to not take decisions on what logging framework should be used (http://radio.weblogs.com/0122027/2003/08/15.html). The problems with not being able to release memory because of framework holding references to the classloaders have largely been fixed in 1.0.5. Then again, commons-logging is only useful if a user *potentially* wants to see log messages from third-party libraries with the application logs (where chances are, the application's either using log4j or loading up its own configuration files in the start-up for java logging). Let's think about this for a moment. Why would an end-user ever want to see log messages from third-party libraries such as MyFaces? Sure, they are useful when you are developing the library but when an application is running it's fairly likely that a bug in the library code would cause a more serious error in the application code, in which case a properly written application would anyways write its own log message about it. So in fact, it might even be desirable that log messages from third-party libraries are by design separated from the application logs. Log4j is more extensive than java logging, but in practice, how many times do you really want rotating logs for library log messages? If we simply used java logging in MyFaces, it'd be one less dependency to worry about and it'd perform better. I guess dependency on 1.4 shouldn't be a problem, though I recall a discussion that you should be able to run JSF 1.1 with JRE 1.3. If one really wants to combine java logging to log4jLogs, I'd think you should be able to fairly easily write a java log handler using log4j logger (don't know how the performance of such a beast would be though...). After all this pondering, my cautions non-binding +0.5 to use java logging throughout MyFaces code :) Kalle
