jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Dawson <tdaw...@is.com>
Subject RE: log4j dependency in taglibs?
Date Sun, 25 Feb 2001 23:17:50 GMT
Shawn Bayern writes:
> Do these conditions cause exceptions to be thrown? If the
> conditions aren't exceptional and you just want to print status
> or debugging information, I'm all for using log4j from taglibs; 
> considering it's part of Jakarta, it's a sensible dependency as
> far as I'm concerned.  

Good question.  Neither of the two items in question (key not found, locale
not found) are exceptional, just informational. The tags allow for handling
of both conditions, but since the people who define the translations often
aren't the same people that write the JSPs I figured the logging might come
in handy. :-)

Glenn Nielsen writes:
> Why does the taglib need to use log4j for logging?  The ServletContext
> already supports logging which is configurable by the servlet 
> container.

The logging support provided by the ServletContext is primitive, and is
really not terribly configurable - at least not in a standard way.  Some
vendors may provide configuration, but others may not, and even then, the
api doesn't allow me to provide any hints to the vendor about the contents
of the log & how it should be processed.


However, as I've thought about this, one thing I keep coming back to is
that, while log4j is extremely useful for logging inside your own code, use
of it by third party components is less useful, since you end up having to
document exactly which log keys you use (or just look through the source) to
have any useful control over the logging.

At this point what I'm planning to do is to add a listener interface that an
i18n taglib user can implement & do log4j logging if desired. This interface
will look something like this:

public interface MissingResourceHandler
  {
  void handleMissingLocale(Locale locale);
  void handleMissingKey(String key, Locale locale);
  }

In the example, I'll supply an implementation that uses System.out.println()
but suggest log4j for serious users.  Assuming this approach doesn't
generate any controversy (I don't expect it to), I'll submit the i18n
library with this approach. Workload permitting, this should be in the next
couple of days.

Tim

Mime
View raw message