]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Consolidated logging calls in dumpConfiguration
authorPeter Bernard West <pbwest@apache.org>
Mon, 8 Mar 2004 21:08:37 +0000 (21:08 +0000)
committerPeter Bernard West <pbwest@apache.org>
Mon, 8 Mar 2004 21:08:37 +0000 (21:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197428 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/configuration/Configuration.java

index 31d9a3af9664b3bf11e65fcbe14b8e1291651d0d..c620b18282fffad476921b4ae59ac172e2d6c90b 100644 (file)
@@ -23,8 +23,8 @@ package org.apache.fop.configuration;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.logging.Level;
 import java.util.logging.Logger;
-
 import org.apache.fop.apps.Fop;
 
 /**
@@ -36,7 +36,7 @@ import org.apache.fop.apps.Fop;
  */
 public class Configuration {
 
-    protected final Logger logger = Logger.getLogger(Fop.fopPackage);
+    protected Logger logger = Logger.getLogger(Fop.fopPackage);
     /**
      * defines role types
      */
@@ -397,52 +397,50 @@ public class Configuration {
      * debug methods, which writes out all information in this configuration
      */
     public void dumpConfiguration() {
-        String key;
-        Object value;
-        ArrayList list;
-        HashMap map, configuration;
-        Iterator iterator;
-        String tmp;
-        System.out.println("Dumping configuration: ");
+        StringBuffer msg = new StringBuffer();
+        logger.setLevel(Level.CONFIG);
         HashMap[] configs = {
             standardConfiguration, pdfConfiguration, awtConfiguration
         };
         for (int i = 0; i < configs.length; i++) {
-            logger.config("----------------------");
-            configuration = configs[i];
+            msg.append("\n----------------------");
+            HashMap configuration = configs[i];
             Iterator iter = configuration.keySet().iterator();
             while (iter.hasNext()) {
-                key = (String)iter.next();
-                logger.config("key: " + key);
-                value = configuration.get(key);
+                String key = (String)iter.next();
+                msg.append("\nkey: " + key);
+                Object value = configuration.get(key);
                 if (value instanceof String) {
-                    logger.config("   value: " + value);
+                    msg.append("   value: " + value);
                 } else if (value instanceof Boolean) {
-                    logger.config
+                    msg.append
                             ("   value: " + ((Boolean)value).booleanValue());
                 } else if (value instanceof Integer) {
-                    logger.config
+                    msg.append
                                 ("   value: " + ((Integer)value).intValue());
                 } else if (value instanceof ArrayList) {
-                    list = (ArrayList)value;
-                    iterator = list.iterator();
-                    StringBuffer msg = new StringBuffer("   values: ");
+                    ArrayList list = (ArrayList)value;
+                    Iterator iterator = list.iterator();
+                    msg.append("   values: ");
+                    if (iterator.hasNext()) {
+                        msg.append("<" + iterator.next() + ">");
+                    }
                     while (iterator.hasNext()) {
-                        msg.append(iterator.next() + " - ");
+                        msg.append(", <" + iterator.next() + ">");
                     }
-                    logger.config(msg.toString());
                 } else if (value instanceof HashMap) {
-                    map = (HashMap)value;
-                    iterator = map.keySet().iterator();
-                    StringBuffer msg = new StringBuffer("   values: ");
+                    HashMap map = (HashMap)value;
+                    Iterator iterator = map.keySet().iterator();
+                    msg.append("   values: ");
                     while (iterator.hasNext()) {
-                        tmp = (String)iterator.next();
-                        msg.append(" " + tmp + ":" + map.get(tmp));
+                        String tmp = (String)iterator.next();
+                        msg.append("\n    " + tmp + ":" + map.get(tmp));
                     }
-                    logger.config(msg.toString());
                 }
             }
         }
+        msg.append("\n");
+        logger.config(msg.toString());
     }
 
 }