pbwest 2004/01/24 18:16:40 Modified: src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design Driver.java InputHandler.java Options.java Fop.java Log: Switch to java.util.logging Revision Changes Path No revision No revision 1.9.2.9 +3 -5 xml-fop/src/java/org/apache/fop/apps/Driver.java Index: Driver.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v retrieving revision 1.9.2.8 retrieving revision 1.9.2.9 diff -u -r1.9.2.8 -r1.9.2.9 --- Driver.java 20 Jan 2004 05:45:54 -0000 1.9.2.8 +++ Driver.java 25 Jan 2004 02:16:40 -0000 1.9.2.9 @@ -52,7 +52,6 @@ package org.apache.fop.apps; -// FOP import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; @@ -60,7 +59,6 @@ import org.apache.fop.configuration.Configuration; import org.apache.fop.fo.FOTree; import org.apache.fop.layout.AreaTree; -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.version.Version; import org.apache.fop.xml.FoXmlSerialHandler; import org.apache.fop.xml.Namespaces; @@ -77,7 +75,7 @@ public class Driver { /** If true, full error stacks are reported */ private static boolean _errorDump = false; - + private InputHandler inputHandler; private XMLReader parser; private InputSource saxSource; @@ -103,7 +101,7 @@ _errorDump = Configuration.getBooleanValue("debugMode").booleanValue(); String version = Version.getVersion(); - MessageHandler.logln(version); + Fop.logger.config(version); } /** 1.4.2.3 +1 -4 xml-fop/src/java/org/apache/fop/apps/InputHandler.java Index: InputHandler.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/InputHandler.java,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -u -r1.4.2.2 -r1.4.2.3 --- InputHandler.java 14 Jan 2004 14:17:19 -0000 1.4.2.2 +++ InputHandler.java 25 Jan 2004 02:16:40 -0000 1.4.2.3 @@ -59,8 +59,6 @@ import org.xml.sax.InputSource; import org.xml.sax.XMLReader; -import org.apache.fop.messaging.MessageHandler; - abstract public class InputHandler { @@ -68,7 +66,6 @@ abstract public InputSource getInputSource(); abstract public XMLReader getParser() throws FOPException; - /** * create an InputSource from a File * @@ -101,7 +98,7 @@ if (parserClassName == null) { parserClassName = "org.apache.xerces.parsers.SAXParser"; } - MessageHandler.logln("using SAX parser " + parserClassName); + Fop.logger.config("using SAX parser " + parserClassName); try { return (XMLReader)Class.forName(parserClassName).newInstance(); 1.1.2.5 +38 -37 xml-fop/src/java/org/apache/fop/apps/Attic/Options.java Index: Options.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Attic/Options.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- Options.java 5 Jan 2004 02:26:54 -0000 1.1.2.4 +++ Options.java 25 Jan 2004 02:16:40 -0000 1.1.2.5 @@ -62,9 +62,8 @@ import java.util.HashMap; import java.util.Set; import java.util.Iterator; - +import java.util.logging.Level; // fop -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.configuration.Configuration; import org.apache.fop.configuration.ConfigurationReader; @@ -93,6 +92,7 @@ private static final String defaultConfigFile = "config.xml"; private static final String defaultUserConfigFile = "userconfig.xml"; + /** * An array of String indexed by the integer constants representing * the various input modes. Provided so that integer modes can be @@ -319,7 +319,7 @@ } catch (Exception e) {} } if (debug) { - MessageHandler.logln("base directory: " + baseDir); + Fop.logger.config("base directory: " + baseDir); } if (dumpConfig) { @@ -330,7 +330,9 @@ // quiet mode - this is the last setting, so there is no way to // supress the logging of messages during options processing if ((bool = isQuiet()) != null) { - MessageHandler.setQuiet(bool.booleanValue()); + if (bool.booleanValue()) { + Fop.logger.setLevel(Level.OFF); + } } } @@ -411,7 +413,7 @@ getConfResourceFile(fname, ConfigurationReader.class); if (debug) { - MessageHandler.logln( + Fop.logger.config( "reading configuration file " + fname); } ConfigurationReader reader = @@ -436,7 +438,7 @@ boolean readOk = true; userConfigFile = new File(userConfigFileName); if (userConfigFile != null) { - MessageHandler.logln( + Fop.logger.config( "reading user configuration file " + userConfigFileName); ConfigurationReader reader = new ConfigurationReader( InputHandler.fileInputSource(userConfigFile)); @@ -446,7 +448,7 @@ try { reader.start(); } catch (org.apache.fop.apps.FOPException error) { - MessageHandler.logln( + Fop.logger.config( "Can't find user configuration file " + userConfigFile + " in user locations"); if (debug) { @@ -459,7 +461,7 @@ // Try reading the file using loadConfig() loadConfiguration(userConfigFileName); } catch (FOPException ex) { - MessageHandler.logln("Can't find user configuration file " + Fop.logger.warning("Can't find user configuration file " + userConfigFile + " in system locations"); if (debug) { reader.dumpError(ex); @@ -620,9 +622,8 @@ // warning if foFile has been set in xslt mode if (foFile != null) { - MessageHandler.errorln( - "WARNING: " - + "Can't use fo file with transform mode! Ignoring.\n" + Fop.logger.warning( + "Can't use fo file with transform mode! Ignoring.\n" + "Your input is " + "\n xmlFile: " + xmlFile.getAbsolutePath() + "\nxsltFile: " @@ -643,11 +644,11 @@ } else if (inputmode == FO_INPUT) { if (xmlFile != null || xsltFile != null) { - MessageHandler.errorln( - "WARNING: fo input mode, but xmlFile or xslt file are set:" + Fop.logger.warning( + "fo input mode, but xmlFile or xslt file are set:" ); - MessageHandler.errorln("xml file: " + xmlFile.toString()); - MessageHandler.errorln("xslt file: " + xsltFile.toString()); + Fop.logger.warning("xml file: " + xmlFile.toString()); + Fop.logger.warning("xslt file: " + xsltFile.toString()); } if (!foFile.exists()) { throw new FileNotFoundException("fo file " @@ -797,7 +798,7 @@ * options and some examples */ public static void printUsage() { - MessageHandler.errorln( + Fop.logger.info( "\nUSAGE\n" + "Fop [options] [-fo|-xml] infile [-xsl file] " + "[-awt|-pdf|-mif|-pcl|-ps|-txt|-at|-print] [outputFile]\n" @@ -847,7 +848,7 @@ * shows the options for print output */ public static void printUsagePrintOutput() { - MessageHandler.errorln( + Fop.logger.info( "USAGE:" + " -print [-Dstart=i] [-Dend=i] [-Dcopies=i] [-Deven=true|false]" + " org.apache.fop.apps.Fop (..) -print \n" @@ -867,56 +868,56 @@ System.out.print("Input mode: "); switch (inputmode) { case NOT_SET: - MessageHandler.logln("not set"); + Fop.logger.config("not set"); break; case FO_INPUT: - MessageHandler.logln("fo "); - MessageHandler.logln("fo input file: " + foFile.toString()); + Fop.logger.config("fo "); + Fop.logger.config("fo input file: " + foFile.toString()); break; default: - MessageHandler.logln("unknown input type"); + Fop.logger.config("unknown input type"); } System.out.print("Output mode: "); switch (outputmode) { case NOT_SET: - MessageHandler.logln("not set"); + Fop.logger.config("not set"); break; case PDF_OUTPUT: - MessageHandler.logln("pdf"); - MessageHandler.logln("output file: " + outputFile.toString()); + Fop.logger.config("pdf"); + Fop.logger.config("output file: " + outputFile.toString()); break; default: - MessageHandler.logln("unknown input type"); + Fop.logger.config("unknown input type"); } - MessageHandler.logln("OPTIONS"); + Fop.logger.config("OPTIONS"); if (userConfigFile != null) { - MessageHandler.logln("user configuration file: " + Fop.logger.config("user configuration file: " + userConfigFile.toString()); } else { - MessageHandler.logln( + Fop.logger.config( "no user configuration file is used [default]"); } if ((bool = isDebugMode()) != null && bool.booleanValue()) { - MessageHandler.logln("debug mode on"); + Fop.logger.config("debug mode on"); } else { - MessageHandler.logln("debug mode off [default]"); + Fop.logger.config("debug mode off [default]"); } if ((bool = doDumpConfiguration()) != null && bool.booleanValue()) { - MessageHandler.logln("dump configuration"); + Fop.logger.config("dump configuration"); } else { - MessageHandler.logln("don't dump configuration [default]"); + Fop.logger.config("don't dump configuration [default]"); } if ((bool = isCoarseAreaXml()) != null && bool.booleanValue()) { - MessageHandler.logln("no low level areas"); + Fop.logger.config("no low level areas"); } else { - MessageHandler.logln("low level areas generated[default]"); + Fop.logger.config("low level areas generated[default]"); } if ((bool = isQuiet()) != null && bool.booleanValue()) { - MessageHandler.logln("quiet mode on"); + Fop.logger.config("quiet mode on"); } else { - MessageHandler.logln("quiet mode off [default]"); + Fop.logger.config("quiet mode off [default]"); } } 1.1.2.4 +6 -4 xml-fop/src/java/org/apache/fop/apps/Fop.java Index: Fop.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Fop.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- Fop.java 14 Jan 2004 14:17:19 -0000 1.1.2.3 +++ Fop.java 25 Jan 2004 02:16:40 -0000 1.1.2.4 @@ -52,7 +52,7 @@ package org.apache.fop.apps; -import org.apache.fop.messaging.MessageHandler; +import java.util.logging.Logger; public class Fop { @@ -62,6 +62,8 @@ public static long startTime; public static long startPCi; public static long endPCi; + + protected static final Logger logger = Logger.getLogger("org.apache.fop"); public static void main(String[] args) { @@ -109,13 +111,13 @@ //System.out.println("PC time : " + (endPCi - startPCi)); } catch (FOPException e) { - MessageHandler.errorln("ERROR: " + e.getMessage()); + logger.warning(e.getMessage()); if ((bool = Options.isDebugMode()) != null && bool.booleanValue()) { e.printStackTrace(); } } catch (java.io.FileNotFoundException e) { - MessageHandler.errorln("ERROR: " + e.getMessage()); + logger.warning(e.getMessage()); if ((bool = Options.isDebugMode()) != null && bool.booleanValue()) { e.printStackTrace();
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]