Victor Mote wrote:
OK. Still I miss your point.

Well, I think loggin is much overrated and it is really overdone
in FOP.
Fatal errors are fatal errors. Just throw an exception and let
someone else figure out what to do. Some examples from the FOP
code where logging doesn't help:
    public int getValue() {
        log.error("getValue() called on " + enumProperty + " length");
        return 0;
    }

     if ((bfSet & MAXSET) != 0) {
        // Warning: min>max, resetting max to min
        log.error("forcing max to min in LengthRange");
     }
     maximum = minimum;

    public Source resolve(String href, String base)
        throws javax.xml.transform.TransformerException {
      ....
           try {
              // the above failed, we give it another go in case
              // the href contains only a path then file: is assumed
              absoluteURL = new URL("file:" + href);
           } catch (MalformedURLException mfue) {
               log.error("Error with URL '" + href + "': " +
                  mue.getMessage(), mue);
                return null;
           }
Especially the latter gets a "Duh!", because of:
 public Source resolveURI(String uri) {
  ...
  if (uriResolver != null) {
    try {
      source = uriResolver.resolve(uri, getBaseURL());
    } catch (TransformerException te) {
      log.error("Attempt to resolve URI '" + uri + "' failed: ", te);
    }
  }
  if (source == null) {
    // URI Resolver not configured or returned null, use default
    //  resolver
    try {
      source = foURIResolver.resolve(uri, getBaseURL());
    } catch (TransformerException te) {
      log.error("Attempt to resolve URI '" + uri + "' failed: ", te);
    }
   }

FOP needs a facility to notify a user about warnings, recoverable
errors and progress reports. There may be a separate facility to
provide debug for developers and yet another to provide out-of-band
results like ressource ussage statistics and number of generated pages.
I don't think that generously sprinkling log.stuff() statements all
over the place is the best solution to the problems above, even though
this seems to fit.

J.Pietschmann

Reply via email to