diff options
author | Simon Pepping <spepping@apache.org> | 2005-09-28 09:03:56 +0000 |
---|---|---|
committer | Simon Pepping <spepping@apache.org> | 2005-09-28 09:03:56 +0000 |
commit | 070fca4bd68a3e8af06db2323f992f7df920ffd2 (patch) | |
tree | a3b8e7a3999c9f4c032d100e59ac841ccadfe410 /src/java/org/apache/fop/cli | |
parent | 985c7a5ec04841e82884683e92710075dcbbfc2f (diff) | |
download | xmlgraphics-fop-070fca4bd68a3e8af06db2323f992f7df920ffd2.tar.gz xmlgraphics-fop-070fca4bd68a3e8af06db2323f992f7df920ffd2.zip |
Another effort to get the warnings for the debug and quiet options
with other loggers than FOP's command line logger right
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@292153 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/cli')
-rw-r--r-- | src/java/org/apache/fop/cli/CommandLineOptions.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/java/org/apache/fop/cli/CommandLineOptions.java b/src/java/org/apache/fop/cli/CommandLineOptions.java index ab7a9b080..44fa2b174 100644 --- a/src/java/org/apache/fop/cli/CommandLineOptions.java +++ b/src/java/org/apache/fop/cli/CommandLineOptions.java @@ -171,13 +171,13 @@ public class CommandLineOptions implements Constants { } 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 @@ public class CommandLineOptions implements Constants { } } + 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."); } } |