chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asrab...@apache.org
Subject svn commit: r786613 - in /hadoop/chukwa/trunk: CHANGES.txt src/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorFactory.java
Date Fri, 19 Jun 2009 18:29:24 GMT
Author: asrabkin
Date: Fri Jun 19 18:29:24 2009
New Revision: 786613

URL: http://svn.apache.org/viewvc?rev=786613&view=rev
Log:
CHUKWA-42. Clean up logging of adaptor creation.

Modified:
    hadoop/chukwa/trunk/CHANGES.txt
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorFactory.java

Modified: hadoop/chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/CHANGES.txt?rev=786613&r1=786612&r2=786613&view=diff
==============================================================================
--- hadoop/chukwa/trunk/CHANGES.txt (original)
+++ hadoop/chukwa/trunk/CHANGES.txt Fri Jun 19 18:29:24 2009
@@ -66,6 +66,8 @@
 
   BUG FIXES
 
+    CHUKWA-42. Clean up logging of adaptor creation. (Ari Rabkin)
+
     CHUKWA-312. Fixed chukwa-pig.jar class path for pig aggregation. (Cheng Zhang via Eric
Yang)
 
     CHUKWA-304. Propagate exception upward for database test cases. (Jerome Boulon via Eric
Yang)

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorFactory.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorFactory.java?rev=786613&r1=786612&r2=786613&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorFactory.java
(original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/agent/AdaptorFactory.java
Fri Jun 19 18:29:24 2009
@@ -23,11 +23,13 @@
 import org.apache.log4j.Logger;
 
 /**
- * Produces new unconfigured adaptors, given the class name of the appender type
- * 
+ * Produces new unconfigured adaptors, given the class name of the appender type.
+ *  Will try the name both in the default package, and then with 
+ *  'org.apache.hadoop.chukwa.datacollection.adaptor' prepended.
+ *  
  */
 public class AdaptorFactory {
-
+  public static final String PREPENDED_PACKAGE = "org.apache.hadoop.chukwa.datacollection.adaptor.";
   static Logger log = Logger.getLogger(ChukwaAgent.class);
 
   /**
@@ -48,25 +50,24 @@
       } else
         return null;
     } catch (Exception e1) {
-      log
-          .warn("Error instantiating new adaptor by class name, "
+      log.debug("Error instantiating new adaptor by class name, "
               + "attempting again, but with default chukwa package prepended, i.e. "
-              + "org.apache.hadoop.chukwa.datacollection.adaptor." + className
+              + PREPENDED_PACKAGE + className
               + ". " + e1);
       try {
         // if failed, try adding default class prefix
         Object obj2 = Class.forName(
-            "org.apache.hadoop.chukwa.datacollection.adaptor." + className)
+            PREPENDED_PACKAGE + className)
             .newInstance();
         if (Adaptor.class.isInstance(obj2)) {
-          log.debug("Succeeded in finding class by adding default chukwa "
+          log.debug("Succeeded in finding class by adding default adaptor "
               + "namespace prefix to class name profided");
           return (Adaptor) obj2;
         } else
           return null;
       } catch (Exception e2) {
-        System.out.println("Also error instantiating new adaptor by classname"
-            + "with prefix added" + e2);
+        log.warn("Error instantiating new adaptor"+ className +  " by classname"
+            + " and also with \"o.a.h.c.datacollection.adaptor\" prefix added", e2);
         return null;
       }
     }



Mime
View raw message