Index: src/edu/ucsb/nceas/metacat/AuthLdap.java
===================================================================
--- src/edu/ucsb/nceas/metacat/AuthLdap.java	(revision 2665)
+++ src/edu/ucsb/nceas/metacat/AuthLdap.java	(revision 2666)
@@ -47,6 +47,9 @@
 import javax.naming.directory.SearchControls;
 import javax.naming.ReferralException;
 import javax.naming.ldap.*;
+
+import org.apache.log4j.Logger;
+
 import java.net.URLDecoder;
 import java.util.Iterator;
 import java.util.HashMap;
@@ -74,8 +77,9 @@
   private String userName;
   private String userPassword;
   ReferralException refExc;
-  //String uid=null;
 
+  private static Logger logMetacat = Logger.getLogger(AuthLdap.class);
+  
   /**
    * Construct an AuthLdap
    */
@@ -110,11 +114,11 @@
       authenticated = ldapAuthenticate(identifier, password);
       // if not found, try looking up a valid DN then auth again
       if (!authenticated) {
-        MetaCatUtil.logMetacat.info("Looking up DN for: " + identifier);
+        logMetacat.info("Looking up DN for: " + identifier);
         identifier = getIdentifyingName(identifier, ldapUrl, ldapBase);
-        MetaCatUtil.logMetacat.info("DN found: " + identifier);
+        logMetacat.info("DN found: " + identifier);
         String decoded = URLDecoder.decode(identifier);
-        MetaCatUtil.logMetacat.info("DN decoded: " + decoded);
+        logMetacat.info("DN decoded: " + decoded);
         identifier = decoded;
         String refUrl = "";
         String refBase = "";
@@ -121,20 +125,20 @@
         if (identifier.startsWith("ldap")) {
           refUrl = identifier.substring(0,
                                         identifier.lastIndexOf("/") + 1);
-          MetaCatUtil.logMetacat.info("Ref ldapUrl: " + refUrl);
+          logMetacat.info("Ref ldapUrl: " + refUrl);
           int position = identifier.indexOf(",");
           int position2 = identifier.indexOf(",", position + 1);
           refBase = identifier.substring(position2 + 1);
-          MetaCatUtil.logMetacat.info("Ref ldapBase: " + refBase);
+          logMetacat.info("Ref ldapBase: " + refBase);
           identifier = identifier.substring(
               identifier.lastIndexOf("/") + 1);
-          MetaCatUtil.logMetacat.info("Trying: " + identifier);
+          logMetacat.info("Trying: " + identifier);
           authenticated = ldapAuthenticate(identifier, password,
                                            refUrl, refBase);
         }
         else {
           identifier = identifier + "," + ldapBase;
-          MetaCatUtil.logMetacat.info("Trying: " + identifier);
+          logMetacat.info("Trying: " + identifier);
           authenticated = ldapAuthenticate(identifier, password);
         }
         //authenticated = ldapAuthenticate(identifier, password);
@@ -142,8 +146,8 @@
 
     }
     catch (NullPointerException e) {
-      MetaCatUtil.logMetacat.info("NullPointerException b' password is null");
-      MetaCatUtil.logMetacat.info("NullPointerException while authenticating in " +
+      logMetacat.error("NullPointerException b' password is null");
+      logMetacat.error("NullPointerException while authenticating in " +
                         "AuthLdap.authenticate: " + e);
       throw new ConnectException(
           "NullPointerException while authenticating in " +
@@ -150,12 +154,12 @@
           "AuthLdap.authenticate: " + e);
     }
     catch (NamingException e) {
-      MetaCatUtil.logMetacat.info("Naming exception while authenticating in " +
+      logMetacat.error("Naming exception while authenticating in " +
                         "AuthLdap.authenticate: " + e);
       e.printStackTrace();
     }
     catch (Exception e) {
-      MetaCatUtil.logMetacat.info(e.getMessage());
+      logMetacat.error(e.getMessage());
     }
     return authenticated;
   }
@@ -196,12 +200,12 @@
               "com.sun.jndi.ldap.LdapCtxFactory");
       env.put(Context.REFERRAL, "throw");
       env.put(Context.PROVIDER_URL, directoryUrl + searchBase);
-      MetaCatUtil.logMetacat.info("PROVIDER_URL set to: " + directoryUrl + searchBase);
+      logMetacat.info("PROVIDER_URL set to: " + directoryUrl + searchBase);
       if (!ldapsUrl.equals(ldapUrl)) {
         // ldap is set on default port 389
         // ldaps is set on second port - 636 by default
-        //env.put(Context.SECURITY_PROTOCOL, "ssl");
-      }
+        // env.put(Context.SECURITY_PROTOCOL, "ssl");
+       }
       env.put(Context.SECURITY_AUTHENTICATION, "simple");
       env.put(Context.SECURITY_PRINCIPAL, identifier);
       env.put(Context.SECURITY_CREDENTIALS, password);
@@ -212,7 +216,7 @@
         //Here to check the authorization
         ctx = new InitialDirContext(env);
         double stopTime = System.currentTimeMillis();
-        MetaCatUtil.logMetacat.info("Connection time thru " + ldapsUrl + " was: " +
+        logMetacat.info("Connection time thru " + ldapsUrl + " was: " +
                           (stopTime - startTime) / 1000 + " seconds.");
         authenticated = true;
         //tls.close();
@@ -228,11 +232,11 @@
         }
       }
       catch (javax.naming.InvalidNameException ine) {
-        MetaCatUtil.logMetacat.info("An invalid DN was provided!");
+        logMetacat.error("An invalid DN was provided!");
       }
       catch (javax.naming.ReferralException re) {
-        MetaCatUtil.logMetacat.info("referral during authentication");
-        MetaCatUtil.logMetacat.info("Referral information: " + re.getReferralInfo());
+        logMetacat.error("referral during authentication");
+        logMetacat.error("Referral information: " + re.getReferralInfo());
         try {
           refExc = re;
 
@@ -240,7 +244,7 @@
           t.start();
           Thread.sleep(5000); //this is a manual override of ldap's
           //hideously long time out period.
-          MetaCatUtil.logMetacat.info("Awake after 5 seconds.");
+          logMetacat.info("Awake after 5 seconds.");
           if (referralContext == null) {
             t.interrupt();
             authenticated = false;
@@ -255,10 +259,10 @@
       }
     }
     else {
-      MetaCatUtil.logMetacat.info("User not found");
+      logMetacat.info("User not found");
     }
     double totStopTime = System.currentTimeMillis();
-    MetaCatUtil.logMetacat.info("total ldap authentication time: " +
+    logMetacat.warn("total ldap authentication time: " +
                       (totStopTime - totStartTime) / 1000 + " seconds");
     return authenticated;
   }
@@ -279,7 +283,7 @@
     Hashtable env = new Hashtable(11);
     env.put(Context.INITIAL_CONTEXT_FACTORY,
             "com.sun.jndi.ldap.LdapCtxFactory");
-    MetaCatUtil.logMetacat.info("setting referrals to: " + referral);
+    logMetacat.info("setting referrals to: " + referral);
     env.put(Context.REFERRAL, referral);
     env.put(Context.PROVIDER_URL, ldapUrl + ldapBase);
     //    non-secure LDAP context; dn are publicly readable
@@ -300,39 +304,39 @@
       // This assumes a dn like "uid=x,o=y,dc=someinst,dc=org"
       int position = user.indexOf(",");
       String comp1 = user.substring(0, position);
-      MetaCatUtil.logMetacat.info("First comp is: " + comp1);
+      logMetacat.info("First comp is: " + comp1);
       String comp2 = user.substring(position + 1,
                                     user.indexOf(",", position + 1));
-      MetaCatUtil.logMetacat.info("Second comp is: " + comp2);
+      logMetacat.info("Second comp is: " + comp2);
 
       //String filter = "(&(" + comp1 + "))";
       String filter = "(&(" + comp1 + ")(" + comp2 + "))";
-      MetaCatUtil.logMetacat.info("Filter is: " + filter);
-      MetaCatUtil.logMetacat.info("Provider URL is: " + ldapUrl + ldapBase);
+      logMetacat.info("Filter is: " + filter);
+      logMetacat.info("Provider URL is: " + ldapUrl + ldapBase);
       NamingEnumeration answer;
       try {
-        MetaCatUtil.logMetacat.info("Trying search 1: " + filter);
+        logMetacat.info("Trying search 1: " + filter);
         answer = ctx.search("", filter, ctls);
-        MetaCatUtil.logMetacat.info("Search 1 complete");
+        logMetacat.info("Search 1 complete");
         if (answer == null) {
-          MetaCatUtil.logMetacat.info("Search 1 answer is null.");
+          logMetacat.info("Search 1 answer is null.");
         }
         if (answer.hasMore()) {
-          MetaCatUtil.logMetacat.info("Search 1 has answers.");
+          logMetacat.info("Search 1 has answers.");
           SearchResult sr = (SearchResult) answer.next();
           identifier = sr.getName();
-          MetaCatUtil.logMetacat.info("Originally Found: " + identifier);
+          logMetacat.info("Originally Found: " + identifier);
           return identifier;
         }
       }
       catch (InvalidSearchFilterException e) {
-        MetaCatUtil.logMetacat.info("Invalid Filter exception thrown (if1)");
+        logMetacat.error("Invalid Filter exception thrown (if1)");
       }
 
       // That failed, so check if it is just a username
       filter = "(" + user + ")";
       try {
-        MetaCatUtil.logMetacat.info("Trying again: " + filter);
+        logMetacat.info("Trying again: " + filter);
         answer = ctx.search("", filter, ctls);
         if (answer.hasMore()) {
           SearchResult sr = (SearchResult) answer.next();
@@ -344,7 +348,7 @@
             identifier = identifier.substring(identifier.lastIndexOf("/") + 1,
                                               identifier.indexOf(","));
           }
-          MetaCatUtil.logMetacat.info("Found: " + identifier);
+          logMetacat.info("Found: " + identifier);
           return identifier;
         }
       }
@@ -352,7 +356,7 @@
 
       // Maybe its a user id (uid)
       filter = "(uid=" + user + ")";
-      MetaCatUtil.logMetacat.info("Trying again: " + filter);
+      logMetacat.info("Trying again: " + filter);
       answer = ctx.search("", filter, ctls);
       if (answer.hasMore()) {
         SearchResult sr = (SearchResult) answer.next();
@@ -364,13 +368,13 @@
           identifier = identifier.substring(identifier.lastIndexOf("/") + 1,
                                             identifier.indexOf(","));
         }
-        MetaCatUtil.logMetacat.info("Found: " + identifier);
+        logMetacat.info("Found: " + identifier);
       }
       else {
 
         // maybe its just a common name
         filter = "(cn=" + user + ")";
-        MetaCatUtil.logMetacat.info("Trying again: " + filter);
+        logMetacat.info("Trying again: " + filter);
         NamingEnumeration answer2 = ctx.search("", filter, ctls);
         if (answer2.hasMore()) {
           SearchResult sr = (SearchResult) answer2.next();
@@ -382,13 +386,13 @@
             identifier = identifier.substring(identifier.lastIndexOf("/") + 1,
                                               identifier.indexOf(","));
           }
-          MetaCatUtil.logMetacat.info("Found: " + identifier);
+          logMetacat.info("Found: " + identifier);
         }
         else {
 
           // ok, last resort, is it a surname?
           filter = "(sn=" + user + ")";
-          MetaCatUtil.logMetacat.info("Trying again: " + filter);
+          logMetacat.info("Trying again: " + filter);
           NamingEnumeration answer3 = ctx.search("", filter, ctls);
           if (answer3.hasMore()) {
             SearchResult sr = (SearchResult) answer3.next();
@@ -401,7 +405,7 @@
               identifier = identifier.substring(identifier.lastIndexOf("/") + 1,
                                                 identifier.indexOf(","));
             }
-            MetaCatUtil.logMetacat.info("Found: " + identifier);
+            logMetacat.info("Found: " + identifier);
           }
         }
       }
@@ -409,11 +413,11 @@
       ctx.close();
     }
     catch (NamingException e) {
-      MetaCatUtil.logMetacat.info("Naming exception while getting dn: " + e);
+      logMetacat.error("Naming exception while getting dn: " + e);
       throw new NamingException(
           "Naming exception in AuthLdap.getIdentifyingName: " + e);
     }
-    MetaCatUtil.logMetacat.info("Returning found identifier as: " + identifier);
+    logMetacat.error("Returning found identifier as: " + identifier);
     return identifier;
   }
 
@@ -495,7 +499,7 @@
         }
       }
       catch (SizeLimitExceededException slee) {
-        MetaCatUtil.logMetacat.info("LDAP Server size limit exceeded. " +
+        logMetacat.error("LDAP Server size limit exceeded. " +
                           "Returning incomplete record set.");
       }
 
@@ -514,7 +518,7 @@
 
     }
     catch (NamingException e) {
-      MetaCatUtil.logMetacat.info("Problem getting users in AuthLdap.getUsers:" + e);
+      logMetacat.error("Problem getting users in AuthLdap.getUsers:" + e);
       //e.printStackTrace(System.err);
       throw new ConnectException(
           "Problem getting users in AuthLdap.getUsers:" + e);
@@ -566,7 +570,7 @@
         }
       }
       catch (SizeLimitExceededException slee) {
-        MetaCatUtil.logMetacat.info("LDAP Server size limit exceeded. " +
+        logMetacat.error("LDAP Server size limit exceeded. " +
                           "Returning incomplete record set.");
       }
 
@@ -581,7 +585,7 @@
 
     }
     catch (NamingException e) {
-      MetaCatUtil.logMetacat.info("Problem getting users for a group in " +
+      logMetacat.error("Problem getting users for a group in " +
                         "AuthLdap.getUsers:" + e);
       throw new ConnectException(
           "Problem getting users for a group in AuthLdap.getUsers:" + e);
@@ -645,11 +649,11 @@
       else {
         filter = "(& " + gfilter + "(uniqueMember=" + foruser + "))";
       }
-      MetaCatUtil.logMetacat.info("searching for groups: " + filter);
+      logMetacat.info("searching for groups: " + filter);
       NamingEnumeration namingEnum = ctx.search(ldapBase, filter, ctls);
 
       // Print the groups
-      MetaCatUtil.logMetacat.info("getting group results.");
+      logMetacat.info("getting group results.");
       while (namingEnum.hasMore()) {
         SearchResult sr = (SearchResult) namingEnum.next();
         tempAttr = sr.getAttributes();
@@ -662,7 +666,7 @@
         }
 
         gvec.add(sr.getName() + "," + ldapBase);
-        MetaCatUtil.logMetacat.info("group " + sr.getName() +
+        logMetacat.info("group " + sr.getName() +
                                  " added to Group vector");
       }
       // Close the context when we're done
@@ -672,20 +676,20 @@
     catch (ReferralException re) {
       refExc = re;
       Thread t = new Thread(new GetGroup());
-      MetaCatUtil.logMetacat.info("Starting thread...");
+      logMetacat.info("Starting thread...");
       t.start();
-      MetaCatUtil.logMetacat.info("sleeping for 5 seconds.");
+      logMetacat.info("sleeping for 5 seconds.");
       try {
         Thread.sleep(5000);
       }
       catch (InterruptedException ie) {
-        MetaCatUtil.logMetacat.info("main thread interrupted: " + ie.getMessage());
+        logMetacat.error("main thread interrupted: " + ie.getMessage());
       }
       //this is a manual override of jndi's hideously long time
       //out period.
-      MetaCatUtil.logMetacat.info("Awake after 5 seconds.");
+      logMetacat.info("Awake after 5 seconds.");
       if (referralContext == null) {
-        MetaCatUtil.logMetacat.info("thread timed out...returning groups: " +
+        logMetacat.info("thread timed out...returning groups: " +
                           gvec.toString());
         String groups[][] = new String[gvec.size()][2];
         for (int i = 0; i < gvec.size(); i++) {
@@ -735,7 +739,7 @@
         dc.close();
       }
       catch (NamingException ne) {
-        MetaCatUtil.logMetacat.info("Naming Exception in AuthLdap.getGroups" +
+        logMetacat.error("Naming Exception in AuthLdap.getGroups" +
                                  ne.getExplanation() + ne.getMessage());
       }
     }
@@ -751,7 +755,7 @@
              "Problem getting groups for a user in AuthLdap.getGroups:" + e);*/
     }
 
-    MetaCatUtil.logMetacat.info("The user is in the following groups: " +
+    logMetacat.warn("The user is in the following groups: " +
                              gvec.toString());
     String groups[][] = new String[gvec.size()][2];
     for (int i = 0; i < gvec.size(); i++) {
@@ -820,7 +824,7 @@
       ctx.close();
     }
     catch (NamingException e) {
-      MetaCatUtil.logMetacat.info("Problem getting attributes in " +
+      logMetacat.error("Problem getting attributes in " +
                         "AuthLdap.getAttributes:" + e);
       throw new ConnectException(
           "Problem getting attributes in AuthLdap.getAttributes:" + e);
@@ -931,7 +935,7 @@
 
     }
     catch (NamingException e) {
-      MetaCatUtil.logMetacat.info("Problem getting subtrees in AuthLdap.getSubtrees:"
+      logMetacat.error("Problem getting subtrees in AuthLdap.getSubtrees:"
                         + e);
       throw new ConnectException(
           "Problem getting subtrees in AuthLdap.getSubtrees:" + e);
@@ -1080,24 +1084,24 @@
     String user = args[0];
     String password = args[1];
 
-    MetaCatUtil.logMetacat.warn("Creating session...");
+    logMetacat.warn("Creating session...");
     AuthLdap authservice = new AuthLdap();
-    MetaCatUtil.logMetacat.warn("Session exists...");
+    logMetacat.warn("Session exists...");
 
     boolean isValid = false;
     try {
-      MetaCatUtil.logMetacat.warn("Authenticating...");
+      logMetacat.warn("Authenticating...");
       isValid = authservice.authenticate(user, password);
       if (isValid) {
-        MetaCatUtil.logMetacat.warn("Authentication successful for: " + user);
+    	  logMetacat.warn("Authentication successful for: " + user);
       }
       else {
-        MetaCatUtil.logMetacat.warn("Authentication failed for: " + user);
+        logMetacat.warn("Authentication failed for: " + user);
       }
 
       // Get attributes for the user
       if (isValid) {
-        MetaCatUtil.logMetacat.warn("\nGetting attributes for user....");
+        logMetacat.info("\nGetting attributes for user....");
         HashMap userInfo = authservice.getAttributes(user, password, user);
         // Print all of the attributes
         Iterator attList = (Iterator) ( ( (Set) userInfo.keySet()).iterator());
@@ -1107,7 +1111,7 @@
           Iterator attvalues = values.iterator();
           while (attvalues.hasNext()) {
             String value = (String) attvalues.next();
-            MetaCatUtil.logMetacat.warn(att + ": " + value);
+            logMetacat.warn(att + ": " + value);
           }
         }
       }
@@ -1114,11 +1118,11 @@
 
       // get the groups
       if (isValid) {
-        MetaCatUtil.logMetacat.warn("\nGetting all groups....");
+        logMetacat.warn("\nGetting all groups....");
         String[][] groups = authservice.getGroups(user, password);
-        MetaCatUtil.logMetacat.warn("Groups found: " + groups.length);
+        logMetacat.info("Groups found: " + groups.length);
         for (int i = 0; i < groups.length; i++) {
-          MetaCatUtil.logMetacat.warn("Group " + i + ": " + groups[i][0]);
+          logMetacat.info("Group " + i + ": " + groups[i][0]);
         }
       }
 
@@ -1125,11 +1129,11 @@
       // get the groups for the user
       String savedGroup = null;
       if (isValid) {
-        MetaCatUtil.logMetacat.warn("\nGetting groups for user....");
+        logMetacat.warn("\nGetting groups for user....");
         String[][] groups = authservice.getGroups(user, password, user);
-        MetaCatUtil.logMetacat.warn("Groups found: " + groups.length);
+        logMetacat.info("Groups found: " + groups.length);
         for (int i = 0; i < groups.length; i++) {
-          MetaCatUtil.logMetacat.warn("Group " + i + ": " + groups[i][0]);
+          logMetacat.info("Group " + i + ": " + groups[i][0]);
           savedGroup = groups[i][0];
         }
       }
@@ -1136,26 +1140,26 @@
 
       // get the users for a group
       if (isValid) {
-        MetaCatUtil.logMetacat.warn("\nGetting users for group....");
-        MetaCatUtil.logMetacat.warn("Group: " + savedGroup);
+        logMetacat.warn("\nGetting users for group....");
+        logMetacat.info("Group: " + savedGroup);
         String[] users = authservice.getUsers(user, password, savedGroup);
-        MetaCatUtil.logMetacat.warn("Users found: " + users.length);
+        logMetacat.info("Users found: " + users.length);
         for (int i = 0; i < users.length; i++) {
-          MetaCatUtil.logMetacat.warn("User " + i + ": " + users[i]);
+          logMetacat.warn("User " + i + ": " + users[i]);
         }
       }
 
       // get all users
       if (isValid) {
-        MetaCatUtil.logMetacat.warn("\nGetting all users ....");
+        logMetacat.warn("\nGetting all users ....");
         String[][] users = authservice.getUsers(user, password);
-        MetaCatUtil.logMetacat.warn("Users found: " + users.length);
+        logMetacat.info("Users found: " + users.length);
 
       }
 
       // get the whole list groups and users in XML format
       if (isValid) {
-        MetaCatUtil.logMetacat.warn("\nTrying principals....");
+        logMetacat.warn("\nTrying principals....");
         authservice = new AuthLdap();
         String out = authservice.getPrincipals(user, password);
         java.io.File f = new java.io.File("principals.xml");
@@ -1165,15 +1169,15 @@
         buff.flush();
         buff.close();
         fw.close();
-        MetaCatUtil.logMetacat.warn("\nFinished getting principals.");
+        logMetacat.warn("\nFinished getting principals.");
       }
 
     }
     catch (ConnectException ce) {
-      MetaCatUtil.logMetacat.info(ce.getMessage());
+      logMetacat.error(ce.getMessage());
     }
     catch (java.io.IOException ioe) {
-      MetaCatUtil.logMetacat.info("I/O Error writing to file principals.txt");
+      logMetacat.error("I/O Error writing to file principals.txt");
     }
   }
 
@@ -1192,18 +1196,18 @@
       try {
         //revise environment variable
         referralInfo = (String) refExc.getReferralInfo();
-        MetaCatUtil.logMetacat.info("Processing referral (pr0): ");
-        MetaCatUtil.logMetacat.info("PROVIDER_URL set to (pr1): " + referralInfo);
+        logMetacat.info("Processing referral (pr0): ");
+        logMetacat.info("PROVIDER_URL set to (pr1): " + referralInfo);
         //env.put(Context.PROVIDER_URL,referralInfo);
         //env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
         //env.put(Context.SECURITY_PRINCIPAL, userName);
         //env.put(Context.SECURITY_CREDENTIALS, userPassword);
         //env.put(Context.REFERRAL, "throw");
-        //MetaCatUtil.logMetacat.info("Processing referral (pr1.info): " + userName,35);
-        //MetaCatUtil.logMetacat.info("Processing referral (pr2)",35);
+        //logMetacat.info("Processing referral (pr1.info): " + userName,35);
+        //logMetacat.info("Processing referral (pr2)",35);
         //rContext = refExc.getReferralContext(env);
         rContext = refExc.getReferralContext();
-        MetaCatUtil.logMetacat.info("Processing referral (pr3)");
+        logMetacat.info("Processing referral (pr3)");
         //casting the context to dircontext and it will create a
         //autherntication or naming exception if DN and password is incorrect
         referralContext = rContext;
@@ -1211,12 +1215,12 @@
         refDirContext.close();
         //get context and jump out the while loop
         moreReferrals = false;
-        MetaCatUtil.logMetacat.info("Processing referral (pr4)");
+        logMetacat.info("Processing referral (pr4)");
       } //try
       //if referral have another referral excption
       catch (ReferralException re) {
-        MetaCatUtil.logMetacat.info("GOT referral exception (re1): " + re.getMessage());
-        MetaCatUtil.logMetacat.info("RE details (re2): " + re.toString(true));
+        logMetacat.warn("GOT referral exception (re1): " + re.getMessage());
+        logMetacat.warn("RE details (re2): " + re.toString(true));
         //keep running in while loop
         moreReferrals = true;
         //assign refExc to new referral exception re
@@ -1224,7 +1228,7 @@
       }
       //catch a authentication exception
       catch (AuthenticationException ae) {
-        MetaCatUtil.logMetacat.warn("Error running referral handler thread (ae1): " +
+        logMetacat.error("Error running referral handler thread (ae1): " +
                           ae.getMessage());
         //check if has another referral
         moreReferrals = refExc.skipReferral();
@@ -1233,7 +1237,7 @@
       }
       //catch a naming exception
       catch (NamingException ne) {
-        MetaCatUtil.logMetacat.warn("Error running referral handler thread (ne1): " +
+        logMetacat.error("Error running referral handler thread (ne1): " +
                           ne.getMessage());
         //check if has another referral
         moreReferrals = refExc.skipReferral();
@@ -1247,7 +1251,7 @@
       implements Runnable {
     public void run() {
       referralContext = null;
-      MetaCatUtil.logMetacat.info("getting groups context");
+      logMetacat.info("getting groups context");
       DirContext refDirContext = null;
       boolean moreReferrals = true;
       //set a while loop is because we don't know if a referral excption
@@ -1258,15 +1262,15 @@
           String refInfo = null;
           refInfo = (String) refExc.getReferralInfo();
           if (refInfo != null) {
-            MetaCatUtil.logMetacat.info("Referral in thread to: " +
+            logMetacat.info("Referral in thread to: " +
                                      refInfo.toString());
           }
           else {
-            MetaCatUtil.logMetacat.info("getting refInfo Manually");
+            logMetacat.info("getting refInfo Manually");
             refInfo = (String) refExc.getReferralContext().getEnvironment().
                 get(Context.PROVIDER_URL);
           }
-          MetaCatUtil.logMetacat.info("refInfo: " + refInfo);
+          logMetacat.info("refInfo: " + refInfo);
 
           env.put(Context.INITIAL_CONTEXT_FACTORY,
                   "com.sun.jndi.ldap.LdapCtxFactory");
@@ -1273,9 +1277,9 @@
           env.put(Context.REFERRAL, "throw");
           env.put(Context.PROVIDER_URL, refInfo);
 
-          MetaCatUtil.logMetacat.info("creating referralContext");
+          logMetacat.info("creating referralContext");
           referralContext = new InitialDirContext(env);
-          MetaCatUtil.logMetacat.info("referralContext created");
+          logMetacat.info("referralContext created");
           //get context and jump out the while loop
           moreReferrals = false;
         } //try
@@ -1286,7 +1290,7 @@
           refExc = re;
         }
         catch (AuthenticationException ae) {
-          MetaCatUtil.logMetacat.info("Error running referral handler thread (ae2): " +
+          logMetacat.error("Error running referral handler thread (ae2): " +
                             ae.getMessage());
           //check if has another referral
           moreReferrals = refExc.skipReferral();
@@ -1294,7 +1298,7 @@
           referralContext = null;
         }
         catch (NamingException ne) {
-          MetaCatUtil.logMetacat.info("Error running referral handler thread (ne2): " +
+          logMetacat.error("Error running referral handler thread (ne2): " +
                             ne.getMessage());
           //check if has another referral
           moreReferrals = refExc.skipReferral();
