On Sat, 26 Mar 2005 20:03:28 +0100, Remy MaucheratThe only thing logical is that there's actually no value in the API
log4j provides to applications: most of them will only use a
featureset equivalent to what commons-logging exposes (as proven by
the fact that nearly everyone uses commons-logging at the moment).
This is a puzzling comment to me. What is the basis of the statement that "nearly everyone" uses Commons Logging? No project that I have ever worked on (outside the ASF) has ever used Commons Logging. They have all used Log4j because of its feature set. I really don't think I'm a part of a small minority here either.
There really is no reason for an application to use JCL. I�m personally surprised that Tomcat chose to do so for its internal logging, and pleased to see that the next version is moving away from it.
JCL is great for libraries, where the code *cannot* make any assumptions about what logging library is available. However there is a significant price to pay for using JCL:
* a "least common denominator API", and
* a significant performance hit.
Application code which can make assumptions about what logging library it will be bundled with should generally code directly to that logging libraries�API. The app then gets a more complete API and better performance. [1]
And libraries which provide fairly simple functionality don�t need logging at all; they can report problems via exceptions.
But for libraries that are complex enough to need logging, but can�t assume a particular logging implementation, what options are there other than commons logging (or UGLI once it is released)? I would really be interested to know! Hard-wiring the use of log4j into such a library isn�t an option for obvious reasons.
Please note that the above is just my personal view..
Regards,
Simon
===
[1] Well, there are a few minor advantages for an app to use JCL.
The deployer can select their own logging library and then write the logging config files in a format they are familiar with, rather than be forced to learn the logging system bundled with the app.
And some logging libraries offer features that others do not. For example, log4j integrates nicely with some log-monitoring apps that other systems do not (and possibly vice versa).
And in memory-limited situations, JCL offers the option of SimpleLog or NoOpLog, at the price of reduced functionality.
But in most cases I think that it is preferable for application code to write direct to a specific logging API.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
