cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject question on getLogger()
Date Tue, 03 Apr 2001 18:55:30 GMT
i thought i'd try my hand at a little LoggingEntityResolver so that we can
try to track file/uri dependencies for the various sitemap components.
unfortunately, i'm having trouble getting access to the Logger -
getLogger() returns null. here's my sample code:

package org.apache.cocoon.xml;

import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import java.io.IOException;
import org.apache.log.Logger;
import org.apache.avalon.AbstractLoggable;
import org.apache.avalon.configuration.Configurable;
import org.apache.avalon.configuration.Configuration;
import org.apache.avalon.configuration.ConfigurationException;

public class LoggingEntityResolver extends AbstractLoggable implements
EntityResolver,Configurable {

  protected EntityResolver resolver;

  public LoggingEntityResolver(EntityResolver resolver) {
    this.resolver = resolver;
  }

  public void configure(Configuration conf) throws ConfigurationException
{}

  public InputSource resolveEntity(String public_id, String system_id)
throws SAXException,IOException {
    InputSource input_source =
resolver.resolveEntity(public_id,system_id);
    StringBuffer sb = new StringBuffer();
    sb.append("Resolving entity: ");
    if (public_id != null) {
      sb.append("public_id: "+public_id);
    }
    if (system_id != null) {
      sb.append("system_id: "+system_id);
    }
    if (input_source != null) {
      sb.append("input_source: "+input_source.toString());
    }
    getLogger().debug(sb.toString());
    return input_source;
  }

}

what's the most succinct way of configuring the class so that getLogger()
is valid and doesn't return null?

- donald


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message