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/service/GS2Construct.java

    r10093 r13124  
    3636import java.util.Locale;
    3737
     38import org.apache.log4j.*;
     39
    3840/**
    3941 * A Services class for building collections
     
    4648    extends ServiceRack {
    4749   
     50     static Category logger = Category.getInstance(org.greenstone.gsdl3.service.GS2Construct.class.getName());
     51
    4852    // services offered
    4953    private static final String NEW_SERVICE = "NewCollection";
     
    166170    GS2PerlListener listener = (GS2PerlListener)this.listeners.get(id);
    167171    if (listener==null) {
    168         System.err.println("somethings gone wrong, couldn't find the listener");
     172        logger.error("somethings gone wrong, couldn't find the listener");
    169173        status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR));
    170174        return response;
     
    217221    if (get_status_only) {
    218222        // at the moment, delete is synchronous. but it may take ages so should do the command in another thread maybe? in which case we will want to ask for status
    219         System.err.println("had a status request for delete - this shouldn't happen!!");
     223        logger.error("had a status request for delete - this shouldn't happen!!");
    220224        //t = this.doc.createTextNode("");
    221225        //status.appendChild(t);
     
    267271    if (get_status_only) {
    268272        // reload is synchronous - this makes no sense
    269         System.err.println("had a status request for reload - this shouldn't happen!!");
     273        logger.error("had a status request for reload - this shouldn't happen!!");
    270274        //t = this.doc.createTextNode("");
    271275        //status.appendChild(t);
     
    300304        command.setAttribute(GSXML.TYPE_ATT, GSXML.SYSTEM_TYPE_ACTIVATE);
    301305    } else {
    302         System.err.println("invalid action name passed to systemRequest:"+action_name);
     306        logger.error("invalid action name passed to systemRequest:"+action_name);
    303307        return;
    304308    }
     
    330334    }
    331335
    332     System.out.println("configuring GS2Construct");
     336    logger.info("configuring GS2Construct");
    333337
    334338    Element e = null;
     
    427431        coll_name = (String)params.get(COL_PARAM);
    428432    }
    429     System.err.println("Coll name = "+coll_name);
     433    logger.error("Coll name = "+coll_name);
    430434    // makes a paramList of the relevant params
    431435    Element other_params = extractOtherParams(params, type);
     
    471475    File collectDir = new File(GSFile.collectDir(this.site_home));
    472476    if (!collectDir.exists()) {
    473         System.err.println("couldn't find collect dir: "+collectDir.toString());
     477        logger.error("couldn't find collect dir: "+collectDir.toString());
    474478        return null;
    475479    }
    476     System.out.println("GS2Construct: reading thru directory "+collectDir.getPath()+" to find collections.");
     480    logger.info("GS2Construct: reading thru directory "+collectDir.getPath()+" to find collections.");
    477481    File[] contents = collectDir.listFiles();
    478482    int num_colls=0;
Note: See TracChangeset for help on using the changeset viewer.