Browse Source

Remaining changes done with Avalon->Commons Logging conversion. (Bug 28237)


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197517 13f79535-47bb-0310-9956-ffa450edef68
tags/Root_Temp_KnuthStylePageBreaking
Glen Mazza 20 years ago
parent
commit
8aacc4b5f5
3 changed files with 65 additions and 52 deletions
  1. 16
    1
      fop.bat
  2. 16
    1
      fop.sh
  3. 33
    50
      src/java/org/apache/fop/apps/CommandLineOptions.java

+ 16
- 1
fop.bat View File

@@ -21,6 +21,21 @@ rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.
:doneStart

set LOGCHOICE=
rem The default commons logger for JDK1.4 is JDK1.4Logger.
rem To use a different logger, uncomment the one desired below
rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
rem set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

set LOGLEVEL=
rem Logging levels
rem Below option is only if you are using SimpleLog instead of the default JDK1.4 Logger.
rem To set logging levels for JDK 1.4 Logger, edit the %JAVA_HOME%\JRE\LIB\logging.properties
rem file instead.
rem Possible SimpleLog values: "trace", "debug", "info" (default), "warn", "error", or "fatal".
rem set LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=INFO

set LIBDIR=%LOCAL_FOP_HOME%lib
set LOCALCLASSPATH=%LOCAL_FOP_HOME%build\fop.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\xml-apis.jar
@@ -34,5 +49,5 @@ set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_core.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jai_codec.jar

java -cp "%LOCALCLASSPATH%" org.apache.fop.apps.Fop %FOP_CMD_LINE_ARGS%
java %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" org.apache.fop.apps.Fop %FOP_CMD_LINE_ARGS%


+ 16
- 1
fop.sh View File

@@ -100,5 +100,20 @@ if $cygwin; then
LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
fi

$JAVACMD -classpath "$LOCALCLASSPATH" $FOP_OPTS org.apache.fop.apps.Fop "$@"
LOGCHOICE=
# The default commons logger for JDK1.4 is JDK1.4Logger.
# To use a different logger, uncomment the one desired below
# LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
# LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
# LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

LOGLEVEL=
# Logging levels
# Below option is only if you are using SimpleLog instead of the default JDK1.4 Logger.
# To set logging levels for JDK 1.4 Logger, edit the %JAVA_HOME%/JRE/LIB/logging.properties
# file instead.
# Possible SimpleLog values: "trace", "debug", "info" (default), "warn", "error", or "fatal".
# LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=INFO

$JAVACMD $LOGCHOICE $LOGLEVEL -classpath "$LOCALCLASSPATH" $FOP_OPTS org.apache.fop.apps.Fop "$@"


+ 33
- 50
src/java/org/apache/fop/apps/CommandLineOptions.java View File

@@ -61,8 +61,6 @@ public class CommandLineOptions {

/* show configuration information */
private Boolean showConfiguration = Boolean.FALSE;
/* suppress any progress information */
private Boolean quiet = Boolean.FALSE;
/* for area tree XML output, only down to block area level */
private Boolean suppressLowLevelAreas = Boolean.FALSE;
/* user configuration file */
@@ -132,16 +130,9 @@ public class CommandLineOptions {
*/
private boolean parseOptions(String[] args) throws FOPException {
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-d") || args[i].equals("--full-error-dump")) {
log = new SimpleLog("FOP");
((SimpleLog) log).setLevel(SimpleLog.LOG_LEVEL_DEBUG);
} else if (args[i].equals("-x")
if (args[i].equals("-x")
|| args[i].equals("--dump-config")) {
showConfiguration = Boolean.TRUE;
} else if (args[i].equals("-q") || args[i].equals("--quiet")) {
quiet = Boolean.TRUE;
log = new SimpleLog("FOP");
((SimpleLog) log).setLevel(SimpleLog.LOG_LEVEL_ERROR);
} else if (args[i].equals("-c")) {
i = i + parseConfigurationOption(args, i);
} else if (args[i].equals("-l")) {
@@ -581,9 +572,7 @@ public class CommandLineOptions {
"\nUSAGE\nFop [options] [-fo|-xml] infile [-xsl file] "
+ "[-awt|-pdf|-mif|-rtf|-pcl|-ps|-txt|-at|-print] <outfile>\n"
+ " [OPTIONS] \n"
+ " -d debug mode \n"
+ " -x dump configuration settings \n"
+ " -q quiet mode \n"
+ " -c cfg.xml use additional configuration file cfg.xml\n"
+ " -l lang the language to use for user information \n"
+ " -s for area tree XML, down to block areas only\n\n"
@@ -628,90 +617,84 @@ public class CommandLineOptions {


/**
* debug mode. outputs all commandline settings
* Outputs all commandline settings
*/
private void dumpConfiguration() {
log.debug("Input mode: ");
log.info("Input mode: ");
switch (inputmode) {
case NOT_SET:
log.debug("not set");
log.info("not set");
break;
case FO_INPUT:
log.debug("FO ");
log.debug("fo input file: " + fofile.toString());
log.info("FO ");
log.info("fo input file: " + fofile.toString());
break;
case XSLT_INPUT:
log.debug("xslt transformation");
log.debug("xml input file: " + xmlfile.toString());
log.debug("xslt stylesheet: " + xsltfile.toString());
log.info("xslt transformation");
log.info("xml input file: " + xmlfile.toString());
log.info("xslt stylesheet: " + xsltfile.toString());
break;
default:
log.debug("unknown input type");
log.info("unknown input type");
}
log.debug("Output mode: ");
log.info("Output mode: ");
switch (outputmode) {
case NOT_SET:
log.debug("not set");
log.info("not set");
break;
case PDF_OUTPUT:
log.debug("pdf");
log.debug("output file: " + outfile.toString());
log.info("pdf");
log.info("output file: " + outfile.toString());
break;
case AWT_OUTPUT:
log.debug("awt on screen");
log.info("awt on screen");
if (outfile != null) {
log.error("awt mode, but outfile is set:");
log.debug("out file: " + outfile.toString());
log.info("out file: " + outfile.toString());
}
break;
case MIF_OUTPUT:
log.debug("mif");
log.debug("output file: " + outfile.toString());
log.info("mif");
log.info("output file: " + outfile.toString());
break;
case RTF_OUTPUT:
log.debug("rtf");
log.debug("output file: " + outfile.toString());
log.info("rtf");
log.info("output file: " + outfile.toString());
break;
case PRINT_OUTPUT:
log.debug("print directly");
log.info("print directly");
if (outfile != null) {
log.error("print mode, but outfile is set:");
log.error("out file: " + outfile.toString());
}
break;
case PCL_OUTPUT:
log.debug("pcl");
log.debug("output file: " + outfile.toString());
log.info("pcl");
log.info("output file: " + outfile.toString());
break;
case PS_OUTPUT:
log.debug("PostScript");
log.debug("output file: " + outfile.toString());
log.info("PostScript");
log.info("output file: " + outfile.toString());
break;
case TXT_OUTPUT:
log.debug("txt");
log.debug("output file: " + outfile.toString());
log.info("txt");
log.info("output file: " + outfile.toString());
break;
case SVG_OUTPUT:
log.debug("svg");
log.debug("output file: " + outfile.toString());
log.info("svg");
log.info("output file: " + outfile.toString());
break;
default:
log.debug("unknown input type");
log.info("unknown input type");
}

log.debug("OPTIONS");
log.info("OPTIONS");
if (userConfigFile != null) {
log.debug("user configuration file: "
log.info("user configuration file: "
+ userConfigFile.toString());
} else {
log.debug("no user configuration file is used [default]");
}

if (quiet == Boolean.TRUE) {
log.debug("quiet mode off [default]");
} else {
log.debug("quiet mode on");
log.info("no user configuration file is used [default]");
}
}


Loading…
Cancel
Save