2006/1/10, Korhonen, Kalle <[EMAIL PROTECTED]>: > > -----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.
Yes, and that's one reason I prefer log4j for all my projects. Easily separate log messages according to their categories (i.e. java package, when using the prefered "static Log in every class" pattern). Separating my application logs from third party or container logs is peanuts. And: I as a J2EE container end user WANT to see log messages from my container. This as well applies to MyFaces optionally being part of J2EE containers. > 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. It is indeed a spec requirement. See "Preface" of spec. And their are still containers out there, that depend on JRE 1.3. WebSphere being one of them AFAIK. > 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...). And here we go: configurate logging in a central (!) logger.properties file that sits in the JRE lib dir. Aaaargh. Think of multiple container or application instances on one machine. A log4j.xml file in my container, that I can change during runtime (like in JBoss) - that's what really rocks! Well, although I think that log4j is the best logging solution, IMO we must not force it upon MyFaces end users. So, I still think that commons-logging is the best tradeoff available. +1 for commons-logging as the one-and-only logging dependency for all MyFaces packages. Manfred
