Index: /greenstone3/trunk/src/java/org/greenstone/gsdl3/service/FedoraSearch.java.tmp
===================================================================
--- /greenstone3/trunk/src/java/org/greenstone/gsdl3/service/FedoraSearch.java.tmp	(revision 20293)
+++ /greenstone3/trunk/src/java/org/greenstone/gsdl3/service/FedoraSearch.java.tmp	(revision 20294)
@@ -44,9 +44,8 @@
 import java.lang.Object;
 
+import org.apache.log4j.*;
 
 /**
  *
- * @author <a href="mailto:chi@cs.waikato.ac.nz">Chi-Yu Huang</a>
- * @version $Revision$
  *
  */
@@ -55,4 +54,5 @@
     extends AbstractSearch {
     
+     static Logger logger = Logger.getLogger(org.greenstone.gsdl3.service.FedoraSearch.class.getName());
     // the services on offer
     // these strings must match what is found in the properties file
@@ -76,12 +76,12 @@
 	Element server_elem = (Element)GSXML.getChildByTagName(info, "fedoraServer");
 	if (server_elem == null) {
-	    System.err.println("FedoraSearch.configure error: no fedoraServer element found");
+	    logger.error("no fedoraServer element found");
 	    return false;
 	}
 	fedora_server_url = server_elem.getAttribute("url");
-	System.err.println("Fedora Server:" + fedora_server_url);
+	logger.info("Fedora Server:" + fedora_server_url);
 
 	if (fedora_server_url.equals("")) {
-	    System.err.println("FedoraSearch.configure error: no url for the fedoraServer element");
+	    logger.error("no url for the fedoraServer element");
 	    return false;
 	}
@@ -113,5 +113,5 @@
 	Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
 	if (param_list == null) {
-	    System.err.println("FedoraSearch Error:: TextQuery request had no paramList.");
+	    logger.error("TextQuery request had no paramList.");
 	    return result;  // Return the empty result
 	}
@@ -160,5 +160,5 @@
 	    
 	    while (result_fedora != null) {
-		System.err.println("Search Result:" + result_fedora.getResultList().length);
+		logger.info("Search Result:" + result_fedora.getResultList().length);
 		for (int i=0; i<result_fedora.getResultList().length; i++) {
 		    ObjectFields o = result_fedora.getResultList()[i];
@@ -202,5 +202,5 @@
 	    }
 	} catch (Exception e) {
-	    System.err.println("ERROR: " + e.getClass().getName()
+	    logger.error("ERROR: " + e.getClass().getName()
 			       + ((e.getMessage()==null) ? "" : ": " + e.getMessage()));
 	}
@@ -210,5 +210,5 @@
 	
 	// Add a metadata element specifying the number of matching documents
-	//System.err.println("FedoraSearch Number of Documents:" + matchNum);
+	//logger.info("FedoraSearch Number of Documents:" + matchNum);
 	GSXML.addMetadata(this.doc, metadata_list, "numDocsMatched", ""+matchNum);
 	
@@ -222,5 +222,5 @@
 	    // check if query contains any fields name (pid, label, fType....)
 	    if (query_terms.matches("^("+ matchFields+").+")){
-		System.err.println("Implementing Specific Query....");
+		logger.info("Implementing Specific Query....");
 
 		List conditions=fedora.server.search.Condition.getConditions(query_terms);
@@ -241,5 +241,5 @@
 		fedora_query.setConditions(cond);
 	    } else {
-		System.err.println("Implementing Simple Query...");
+		logger.info("Implementing Simple Query...");
 		fedora_query.setTerms(query_terms);
 	    }
Index: /greenstone3/trunk/src/java/org/greenstone/gsdl3/service/GoogleSearch.java.tmp
===================================================================
--- /greenstone3/trunk/src/java/org/greenstone/gsdl3/service/GoogleSearch.java.tmp	(revision 20293)
+++ /greenstone3/trunk/src/java/org/greenstone/gsdl3/service/GoogleSearch.java.tmp	(revision 20294)
@@ -32,4 +32,5 @@
 import java.lang.Object;
 
+import org.apache.log4j.*;
 
 /**
@@ -42,4 +43,6 @@
     extends AbstractSearch {
     
+     static Logger logger = Logger.getLogger(org.greenstone.gsdl3.service.GoogleSearch.class.getName());
+     
     //Parameters connect to Proxy Server
     private boolean using_proxy = false;
@@ -62,8 +65,8 @@
 	    return false;
 	}
-	System.err.println("Configuring GoogleSearch");
+	logger.info("Configuring GoogleSearch");
 	Element server_elem = (Element)GSXML.getChildByTagName(info, "googleServer");
 	if (server_elem == null) {
-	    System.err.println("GoogleSearch.configure error: no googleServer element found");
+	    logger.error("no googleServer element found");
 	    return false;
 	}
@@ -71,5 +74,5 @@
 	client_key = server_elem.getAttribute("key");
 	if (client_key.equals("")) {
-	    System.err.println("GoogleSearch.configure error: no client_key for the googleServer element");
+	    logger.error("no client_key for the googleServer element");
 	    return false;
 	}
@@ -86,5 +89,5 @@
 		proxy_port = Integer.parseInt(System.getProperty("http.proxyPort").trim());
 	    } catch (Exception e) {
-		System.err.println("GoogleSearch.configure error: couldn't get proxy port, defaulting to 80");
+		logger.error("couldn't get proxy port, defaulting to 80");
 		proxy_port = 80;
 	    }
@@ -127,5 +130,5 @@
 	Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
 	if (param_list == null) {
-	    System.err.println("GoogleSearch.processTextQuery Error:: TextQuery request had no paramList.");
+	    logger.error("TextQuery request had no paramList.");
 	    return result;  // Return the empty result
 	}
@@ -137,5 +140,5 @@
 	String query = (String) params.get(QUERY_PARAM);
 	if (query == null || query.equals("")) {
-	    System.err.println("GoogleSearch.processTextQuery Error: TextQuery request had no query string.");
+	    logger.error("TextQuery request had no query string.");
 	    return result;  // Return the empty result
 	}
@@ -150,5 +153,5 @@
 	    hits_per_page = Integer.parseInt(((String)params.get(HITS_PER_PAGE_PARAM)).trim());
 	} catch (Exception e) {
-	    System.err.println("GoogleSearch.processTextQuery error: couldn't get hits per page param, defaulting to 10");
+	    logger.error("couldn't get hits per page param, defaulting to 10");
 	    hits_per_page = 10;
 	}
@@ -158,5 +161,5 @@
 	    start_page = Integer.parseInt(((String) params.get(START_PAGE_PARAM)).trim());
 	} catch (Exception e) {
-	    System.err.println("GoogleSearch.processTextQuery error: couldn't get start page param, defaulting to 1");
+	    logger.error("couldn't get start page param, defaulting to 1");
 	    start_page = 1;
 	}
@@ -182,5 +185,5 @@
 		google_result = search.doSearch();
 	    } catch (GoogleSearchFault ex) {
-		System.err.println("GoogleSearch.processTextQuery error: the call to the Google Web APIs failed:" + ex.toString());
+		logger.error("the call to the Google Web APIs failed:" + ex.toString());
 		// add the error to the result
 		return result;
