xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spepp...@apache.org
Subject svn commit: r292153 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
Date Wed, 28 Sep 2005 09:03:59 GMT
Author: spepping
Date: Wed Sep 28 02:03:56 2005
New Revision: 292153

URL: http://svn.apache.org/viewcvs?rev=292153&view=rev
Log:
Another effort to get the warnings for the debug and quiet options
with other loggers than FOP's command line logger right

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java?rev=292153&r1=292152&r2=292153&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java Wed Sep 28 02:03:56
2005
@@ -171,13 +171,13 @@
             } else if (args[i].equals("-s")) {
                 suppressLowLevelAreas = Boolean.TRUE;
             } else if (args[i].equals("-d")) {
-                setLogLevel("debug");
+                setLogOption("debug", "debug");
             } else if (args[i].equals("-r")) {
                 foUserAgent.setStrictValidation(false);
             } else if (args[i].equals("-dpi")) {
                 i = i + parseResolution(args, i);
             } else if (args[i].equals("-q") || args[i].equals("--quiet")) {
-                setLogLevel("error");
+                setLogOption("quiet", "error");
             } else if (args[i].equals("-fo")) {
                 i = i + parseFOInputOption(args, i);
             } else if (args[i].equals("-xsl")) {
@@ -461,17 +461,24 @@
         }
     }
 
+    private void setLogOption (String option, String level) {
+        if (log instanceof CommandLineLogger
+            || System.getProperty("org.apache.commons.logging.Log") == null) {
+            setLogLevel(level);
+        } else if (log != null) {
+            log.warn("The option " + option + " can only be used");
+            log.warn("with FOP's command line logger,");
+            log.warn("which is the default on the command line.");
+            log.warn("Configure other loggers using Java system properties.");
+        }
+    }
+
     private void setLogLevel(String level) {
         // Set the level for future loggers.
         LogFactory.getFactory().setAttribute("level", level);
         if (log instanceof CommandLineLogger) {
-            // Set the level for the logger creates already.
+            // Set the level for the logger created already.
             ((CommandLineLogger) log).setLogLevel(level);
-        } else {
-            //log.warn("Setting the log level to debug probably failed.");
-            //log.warn("Configure the log level using Java system properties,");
-            //log.warn("or use FOP's command line logger,");
-            //log.warn("which is the default on the command line.");
         }
     }
         



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message