Ignore:
Timestamp:
2006-10-17T15:52:42+13:00 (18 years ago)
Author:
shaoqun
Message:

added the code to use log4j and replace system.out or system.err to logger.info or logger.error respectively. The commented out output has been replaced with logger.debug. The log file is in web/logs/greenstone.log

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/core/DefaultReceptionist.java

    r9874 r13124  
    1414import java.util.Enumeration;
    1515
     16import org.apache.log4j.*;
     17
    1618/** The default greenstone receptionist - needs some extra info for each page
    1719 */
    1820public class DefaultReceptionist extends TransformingReceptionist {
     21
     22     static Category logger = Category.getInstance(org.greenstone.gsdl3.core.DefaultReceptionist.class.getName());
    1923   
    2024    protected void addExtraInfo(Element page) {
     
    2731    String action = page_request.getAttribute(GSXML.ACTION_ATT);
    2832    if (action.equals("s")) {
    29         System.err.println("HACK: don't ask for coll info if system action");
     33        logger.error("HACK: don't ask for coll info if system action");
    3034        return;
    3135    }
    32     ///ystem.out.println("add extra info, page request="+this.converter.getString(page_request));
     36    logger.debug("add extra info, page request="+this.converter.getString(page_request));
    3337    // is a collection defined?
    3438    Element param_list = (Element)GSXML.getChildByTagName(page_request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
    3539    if (param_list==null) { // must be the original home page
    36         ///ystem.out.println("DefaultReceptionist: no param list, assuming home page");
     40        logger.debug(" no param list, assuming home page");
    3741        return;
    3842    }
    3943    Element coll_param = GSXML.getNamedElement(param_list, GSXML.PARAM_ELEM, GSXML.NAME_ATT, GSParams.COLLECTION);
    4044    if (coll_param == null) {
    41         ///ystem.out.println("DefaultReceptionist: coll param is null, returning");
     45        logger.debug(" coll param is null, returning");
    4246        return;
    4347    }
     
    7579       
    7680        if (coll_description == null) {
    77         System.err.println("DefaultReceptionist: no collection description, returning");
     81        logger.error(" no collection description, returning");
    7882        return;
    7983        }
     
    8993    Element service_list = (Element)GSXML.getChildByTagName(coll_description, GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER);
    9094    if (service_list == null) {
    91         System.err.println("DefaultReceptionist: no service list, returning");
     95        logger.error(" no service list, returning");
    9296        // something weird has gone wrong
    9397        return;
     
    96100    NodeList services = service_list.getElementsByTagName(GSXML.SERVICE_ELEM);
    97101    if (services.getLength()==0) {
    98         System.err.println("DefaultReceoptionist: no services found for colllection/cluster "+ coll_name);
     102        logger.error("DefaultReceoptionist: no services found for colllection/cluster "+ coll_name);
    99103        return;
    100104    }
     
    118122
    119123    // if get here, we need to get the service descriptions
    120     ///ystem.out.println("getting services description");
     124    logger.debug("getting services description");
    121125       
    122126    // we will send all the requests in a single message
     
    139143    // check that have same number of responses as collections
    140144    if (services.getLength() != service_responses.getLength()) {
    141         System.err.println("DefaultReceptionist Error: didn't get a response for each service - somethings gone wrong!");
     145        logger.error(" didn't get a response for each service - somethings gone wrong!");
    142146        // for now, dont use the metadata
    143147    } else {
     
    149153            GSXML.mergeElements(c1, c2);
    150154        } else {
    151             System.err.println("DefaultReceptionist Error: response does not correspond to request!");
     155            logger.error(" response does not correspond to request!");
    152156        }
    153157       
Note: See TracChangeset for help on using the changeset viewer.