]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Initialize system properties for logging before setting up Logger.
authorPeter Bernard West <pbwest@apache.org>
Mon, 8 Mar 2004 22:59:55 +0000 (22:59 +0000)
committerPeter Bernard West <pbwest@apache.org>
Mon, 8 Mar 2004 22:59:55 +0000 (22:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197435 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/apps/Fop.java

index f037adc07edeaec67b6e8ddfc166c903c26f2359..515615173b1b20060b3f645c24289e05276a77ae 100644 (file)
 
 package org.apache.fop.apps;
 
+//import java.util.logging.Handler;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.fop.configuration.ConfigurationResource;
 import org.apache.fop.configuration.Configuration;
 
 public class Fop {
@@ -39,16 +45,34 @@ public class Fop {
      */
     public static final String fopPackage = "org.apache.fop";
     
-    public static final Logger logger = Logger.getLogger(fopPackage);
-    static {
-        logger.setLevel(Level.INFO);
-    }
+    private static Logger logger;
     
     public Configuration configuration = new Configuration();
 
     public static void main(String[] args) {
 
         long endtotal, endfree, gctotal, gcfree;
+        Properties properties;
+        try {
+            // Get the initial system properties
+            InputStream propsfile =
+                ConfigurationResource.getResourceFile(
+                        "conf/fop.system.properties", Fop.class);
+            properties = new Properties();
+            properties.load(propsfile);
+        } catch (FOPException e1) {
+            throw new RuntimeException(e1);
+        } catch (IOException e1) {
+            throw new RuntimeException(e1);
+        }
+        Enumeration props = properties.keys();
+        while (props.hasMoreElements()) {
+            String key = (String)(props.nextElement());
+            System.setProperty(key, properties.getProperty(key));
+        }
+        // Now that the Fop system properties have been added, set up logger
+        logger = Logger.getLogger(fopPackage);
+        // Then restrict to WARNING
         Driver driver;
         Configuration configuration;
         FOPOptions options = null;