From: Peter Bernard West Date: Mon, 8 Mar 2004 21:08:37 +0000 (+0000) Subject: Consolidated logging calls in dumpConfiguration X-Git-Tag: Alt-Design_pre_awt_renderer_import~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=edc0940dbb8674d234d32f0523ac77398d91fa33;p=xmlgraphics-fop.git Consolidated logging calls in dumpConfiguration git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197428 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/configuration/Configuration.java b/src/java/org/apache/fop/configuration/Configuration.java index 31d9a3af9..c620b1828 100644 --- a/src/java/org/apache/fop/configuration/Configuration.java +++ b/src/java/org/apache/fop/configuration/Configuration.java @@ -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()); } }