diff options
33 files changed, 79 insertions, 140 deletions
@@ -7,7 +7,7 @@ if "%JAVA_HOME%" == "" goto error set LIBDIR=lib set LOCALCLASSPATH=%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\classes.zip;%LIBDIR%\ant.jar;%LIBDIR%\batik.jar;%LIBDIR%\buildtools.jar;%LIBDIR%\xerces-1.4.3.jar;%LIBDIR%\xalan-2.2D11.jar -set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar;%LIBDIR%\logkit-1.0.jar +set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\jimi-1.0.jar;%LIBDIR%\avalon-framework-cvs-20020315.jar set ANT_HOME=%LIBDIR% @@ -14,7 +14,7 @@ if [ "$JAVA_HOME" = "" ] ; then fi LIBDIR=lib LOCALCLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/classes.zip:$LIBDIR/ant.jar:$LIBDIR/batik.jar:$LIBDIR/buildtools.jar:$LIBDIR/xerces-1.4.3.jar:$LIBDIR/xalan-2.2D11.jar -LOCALCLASSPATH=$LOCALCLASSPATH:$LIBDIR/jimi-1.0.jar:$LIBDIR/logkit-1.0.jar +LOCALCLASSPATH=$LOCALCLASSPATH:$LIBDIR/jimi-1.0.jar:$LIBDIR/avalon-framework-cvs-20020315.jar ANT_HOME=$LIBDIR @@ -128,7 +128,7 @@ Sometimes ant gives out this warnings, but the build is finished without any pro <include name="lib/xerces-1.4.3.jar"/> <include name="lib/xalan-2.2D11.jar"/> <include name="lib/batik.jar"/> - <include name="lib/logkit-1.0.jar"/> + <include name="lib/avalon-framework-cvs-20020315.jar"/> <include name="lib/jimi*"/> </fileset> @@ -275,7 +275,7 @@ Sometimes ant gives out this warnings, but the build is finished without any pro <taskdef name="runTest" classname="org.apache.fop.tools.anttasks.RunTest"/> <property name="main.class" value="org.apache.fop.apps.Fop"/> - <property name="runtime.classpath" value="lib/xerces-1.4.3.jar lib/xalan-2.2D11.jar lib/batik.jar lib/jimi-1.0.jar lib/logkit-1.0.jar"/> + <property name="runtime.classpath" value="lib/xerces-1.4.3.jar lib/xalan-2.2D11.jar lib/batik.jar lib/jimi-1.0.jar lib/avalon-framework-cvs-20020315.jar"/> <filter filtersfile="${build.src}/codegen/filter"/> diff --git a/docs/xml-docs/fop/embedding.xml b/docs/xml-docs/fop/embedding.xml index 919fa98e8..d7734368d 100644 --- a/docs/xml-docs/fop/embedding.xml +++ b/docs/xml-docs/fop/embedding.xml @@ -37,6 +37,18 @@ driver.setRenderer(RENDER_PDF); driver.run();]]></source> + <p>You also need to set up logging. Global logging for all FOP + processes is managed by MessageHandler. Per-instance logging + is handled by Driver. You want to set both using an implementation + of org.apache.avalon.framework.logger.Logger. See + <jump href="http://jakarta.apache.org/avalon/framework/">Jakarta + Avalon Framework</jump> for more information. + </p> + <source><![CDATA[ + Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); + MessageHandler.setScreenLogger(logger); + driver.setLogger(logger);]]></source> + <p>To setup the user config file you can do the following </p> <source><![CDATA[ @@ -1 +1 @@ -java -cp build\fop.jar;lib\batik.jar;lib\xalan-2.0.0.jar;lib\xerces-1.2.3.jar;lib\avalon-framework-4.0.jar;lib\logkit-1.0b4.jar;lib\jimi-1.0.jar org.apache.fop.apps.Fop %1 %2 %3 %4 %5 %6 %7 %8 +java -cp build\fop.jar;lib\batik.jar;lib\xalan-2.0.0.jar;lib\xerces-1.2.3.jar;lib\avalon-framework-4.0.jar;lib\avalon-framework-cvs-20020315.jar;lib\jimi-1.0.jar org.apache.fop.apps.Fop %1 %2 %3 %4 %5 %6 %7 %8 diff --git a/lib/avalon-framework-cvs-20020315.jar b/lib/avalon-framework-cvs-20020315.jar Binary files differnew file mode 100644 index 000000000..c2c75e182 --- /dev/null +++ b/lib/avalon-framework-cvs-20020315.jar diff --git a/lib/logkit-1.0.LICENSE.txt b/lib/avalon.LICENSE.txt index 85486bf4a..eec6a9dca 100644 --- a/lib/logkit-1.0.LICENSE.txt +++ b/lib/avalon.LICENSE.txt @@ -4,7 +4,7 @@ The Apache Software License, Version 1.1 ============================================================================ - Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. + Copyright (C) @year@ The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: @@ -22,10 +22,10 @@ Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. - 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be - used to endorse or promote products derived from this software without - prior written permission. For written permission, please contact - apache@apache.org. + 4. The names "Jakarta", "Apache Avalon", "Avalon Excalibur", "Avalon + Framework" and "Apache Software Foundation" must not be used to endorse + or promote products derived from this software without prior written + permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the diff --git a/lib/logkit-1.0.jar b/lib/logkit-1.0.jar Binary files differdeleted file mode 100644 index 8b1d2c144..000000000 --- a/lib/logkit-1.0.jar +++ /dev/null diff --git a/src/org/apache/fop/apps/CommandLineOptions.java b/src/org/apache/fop/apps/CommandLineOptions.java index c5d6975aa..a8d3c0872 100644 --- a/src/org/apache/fop/apps/CommandLineOptions.java +++ b/src/org/apache/fop/apps/CommandLineOptions.java @@ -16,10 +16,9 @@ import java.io.FileNotFoundException; import org.apache.fop.configuration.Configuration; import org.apache.fop.apps.FOPException; -import org.apache.log.*; -import org.apache.log.format.*; -import org.apache.log.output.io.*; -import org.apache.log.output.*; +// Avalon +import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.avalon.framework.logger.Logger; import java.io.*; @@ -93,24 +92,7 @@ public class CommandLineOptions { public CommandLineOptions(String[] args) throws FOPException, FileNotFoundException { - Hierarchy hierarchy = Hierarchy.getDefaultHierarchy(); - PatternFormatter formatter = new PatternFormatter( - "[%{priority}]: %{message}\n%{throwable}" ); - - LogTarget target = null; - boolean doConsoleLogging = true; - if (doConsoleLogging) { - target = new StreamTarget(System.out, formatter); - } else { - try { - File f = new File("fop.log"); - target = new FileTarget(f, false, formatter); - } catch (IOException e) {} - } - - hierarchy.setDefaultLogTarget(target); - log = hierarchy.getLoggerFor("fop"); - log.setPriority(Priority.INFO); + log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); boolean optionsParsed = true; rendererOptions = new java.util.HashMap(); @@ -141,13 +123,13 @@ public class CommandLineOptions { for (int i = 0; i < args.length; i++) { if (args[i].equals("-d") || args[i].equals("--full-error-dump")) { errorDump = new Boolean(true); - log.setPriority(Priority.DEBUG); + log = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG); } else if (args[i].equals("-x") || args[i].equals("--dump-config")) { dumpConfiguration = new Boolean(true); } else if (args[i].equals("-q") || args[i].equals("--quiet")) { quiet = new Boolean(true); - log.setPriority(Priority.ERROR); + log = new ConsoleLogger(ConsoleLogger.LEVEL_ERROR); } else if (args[i].equals("-c")) { if ((i + 1 == args.length) || (args[i + 1].charAt(0) == '-')) { diff --git a/src/org/apache/fop/apps/CommandLineStarter.java b/src/org/apache/fop/apps/CommandLineStarter.java index 77260cadb..e3db06fe8 100644 --- a/src/org/apache/fop/apps/CommandLineStarter.java +++ b/src/org/apache/fop/apps/CommandLineStarter.java @@ -13,8 +13,6 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; -import org.apache.log.*; - // Java import java.io.*; import java.net.URL; diff --git a/src/org/apache/fop/apps/Driver.java b/src/org/apache/fop/apps/Driver.java index 9afb518cc..8d4992fd4 100644 --- a/src/org/apache/fop/apps/Driver.java +++ b/src/org/apache/fop/apps/Driver.java @@ -20,10 +20,9 @@ import org.apache.fop.tools.DocumentReader; import org.apache.fop.render.pdf.PDFRenderer; -import org.apache.log.*; -import org.apache.log.format.*; -import org.apache.log.output.io.*; -import org.apache.log.output.*; +// Avalon +import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.avalon.framework.logger.Logger; // DOM import org.w3c.dom.Document; @@ -227,18 +226,10 @@ public class Driver { private Logger getLogger() { if(log == null) { - Hierarchy hierarchy = Hierarchy.getDefaultHierarchy(); - PatternFormatter formatter = new PatternFormatter( - "[%{priority}]: %{message}\n%{throwable}" ); + log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); + log.error("Logger not set"); + } - LogTarget target = null; - target = new StreamTarget(System.out, formatter); - - hierarchy.setDefaultLogTarget(target); - log = hierarchy.getLoggerFor("fop"); - log.setPriority(Priority.INFO); - log.error("Logger not set"); - } return log; } diff --git a/src/org/apache/fop/apps/Starter.java b/src/org/apache/fop/apps/Starter.java index 3f9997e63..a3dc669fe 100644 --- a/src/org/apache/fop/apps/Starter.java +++ b/src/org/apache/fop/apps/Starter.java @@ -7,7 +7,8 @@ package org.apache.fop.apps; -import org.apache.log.*; +// Avalon +import org.apache.avalon.framework.logger.Logger; // SAX import org.xml.sax.XMLReader; diff --git a/src/org/apache/fop/apps/StreamRenderer.java b/src/org/apache/fop/apps/StreamRenderer.java index a6bbe2a29..01ca2e531 100644 --- a/src/org/apache/fop/apps/StreamRenderer.java +++ b/src/org/apache/fop/apps/StreamRenderer.java @@ -16,7 +16,7 @@ import org.apache.fop.datatypes.IDReferences; import org.apache.fop.extensions.ExtensionObj; import org.apache.fop.fo.pagination.PageSequence; -import org.apache.log.Logger; +import org.apache.avalon.framework.logger.Logger; /** This class acts as a bridge between the XML:FO parser diff --git a/src/org/apache/fop/datatypes/ToBeImplementedProperty.java b/src/org/apache/fop/datatypes/ToBeImplementedProperty.java index f21d08e57..63cfa957f 100644 --- a/src/org/apache/fop/datatypes/ToBeImplementedProperty.java +++ b/src/org/apache/fop/datatypes/ToBeImplementedProperty.java @@ -9,8 +9,6 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.*; -import org.apache.log.*; - public class ToBeImplementedProperty extends Property { public static class Maker extends Property.Maker { @@ -31,9 +29,17 @@ public class ToBeImplementedProperty extends Property { } public ToBeImplementedProperty(String propName) { - Logger log = Hierarchy.getDefaultHierarchy().getLoggerFor("fop"); - log.warn("property - \"" + propName - + "\" is not implemented yet."); + + // XXX: (mjg@recalldesign.com) This is a bit of a kluge, perhaps an + // UnimplementedPropertyException or something similar should + // get thrown here instead. + // + // This was solved on the maintenance branch by using + // MessageHandler, btu that doesn't exist on the trunk + +// Logger log = Hierarchy.getDefaultHierarchy().getLoggerFor("fop"); +// log.warn("property - \"" + propName +// + "\" is not implemented yet."); } } diff --git a/src/org/apache/fop/fo/FONode.java b/src/org/apache/fop/fo/FONode.java index 948838f7c..2e0dc72d8 100644 --- a/src/org/apache/fop/fo/FONode.java +++ b/src/org/apache/fop/fo/FONode.java @@ -13,7 +13,8 @@ import org.apache.fop.apps.StreamRenderer; import org.apache.fop.layout.Area; import org.apache.fop.util.CharUtilities; -import org.apache.log.Logger; +// Avalon +import org.apache.avalon.framework.logger.Logger; import org.xml.sax.Attributes; diff --git a/src/org/apache/fop/fo/FOTreeBuilder.java b/src/org/apache/fop/fo/FOTreeBuilder.java index a446693ee..988f7739f 100644 --- a/src/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/org/apache/fop/fo/FOTreeBuilder.java @@ -15,7 +15,8 @@ import org.apache.fop.fo.pagination.Root; import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.extensions.ExtensionObj; -import org.apache.log.Logger; +// Avalon +import org.apache.avalon.framework.logger.Logger; // SAX import org.xml.sax.helpers.DefaultHandler; diff --git a/src/org/apache/fop/fo/FOUserAgent.java b/src/org/apache/fop/fo/FOUserAgent.java index 4736ed51f..f81753d83 100644 --- a/src/org/apache/fop/fo/FOUserAgent.java +++ b/src/org/apache/fop/fo/FOUserAgent.java @@ -9,7 +9,8 @@ package org.apache.fop.fo; import org.apache.fop.render.XMLHandler; import org.apache.fop.render.RendererContext; -import org.apache.log.Logger; + +import org.apache.avalon.framework.logger.Logger; import org.w3c.dom.*; diff --git a/src/org/apache/fop/fo/Property.java b/src/org/apache/fop/fo/Property.java index 12fca1c19..116c1daeb 100644 --- a/src/org/apache/fop/fo/Property.java +++ b/src/org/apache/fop/fo/Property.java @@ -15,7 +15,7 @@ import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.apps.FOPException; import java.util.Vector; -import org.apache.log.Logger; +import org.apache.avalon.framework.logger.Logger; public class Property { diff --git a/src/org/apache/fop/fo/pagination/PageNumberGenerator.java b/src/org/apache/fop/fo/pagination/PageNumberGenerator.java index 8c3e6c257..facb47f48 100644 --- a/src/org/apache/fop/fo/pagination/PageNumberGenerator.java +++ b/src/org/apache/fop/fo/pagination/PageNumberGenerator.java @@ -7,9 +7,11 @@ package org.apache.fop.fo.pagination; +// FOP import org.apache.fop.fo.properties.*; -import org.apache.log.*; +// Avalon +import org.apache.avalon.framework.logger.Logger; // Java import java.util.*; diff --git a/src/org/apache/fop/image/ImageCache.java b/src/org/apache/fop/image/ImageCache.java index b94d8b73f..073f23e47 100644 --- a/src/org/apache/fop/image/ImageCache.java +++ b/src/org/apache/fop/image/ImageCache.java @@ -10,8 +10,6 @@ package org.apache.fop.image; // FOP import org.apache.fop.fo.FOUserAgent; -import org.apache.log.Logger; - public interface ImageCache { public FopImage getImage(String url, FOUserAgent context); public void releaseImage(String url, FOUserAgent context); diff --git a/src/org/apache/fop/image/ImageFactory.java b/src/org/apache/fop/image/ImageFactory.java index 6eccd37c2..4308848cd 100644 --- a/src/org/apache/fop/image/ImageFactory.java +++ b/src/org/apache/fop/image/ImageFactory.java @@ -27,7 +27,8 @@ import org.apache.fop.image.analyser.ImageReaderFactory; import org.apache.fop.image.analyser.ImageReader; import org.apache.fop.fo.FOUserAgent; -import org.apache.log.Logger; +// Avalon +import org.apache.avalon.framework.logger.Logger; /* handle context: base dir, logger, caching diff --git a/src/org/apache/fop/render/AbstractRenderer.java b/src/org/apache/fop/render/AbstractRenderer.java index a1aceeac8..9f564bf97 100644 --- a/src/org/apache/fop/render/AbstractRenderer.java +++ b/src/org/apache/fop/render/AbstractRenderer.java @@ -16,7 +16,8 @@ import org.apache.fop.area.inline.Character; import org.apache.fop.area.inline.Space; import org.apache.fop.fo.FOUserAgent; -import org.apache.log.Logger; +// Avalon +import org.apache.avalon.framework.logger.Logger; // Java import java.awt.geom.Rectangle2D; diff --git a/src/org/apache/fop/render/Renderer.java b/src/org/apache/fop/render/Renderer.java index c88a56c44..a40de294a 100644 --- a/src/org/apache/fop/render/Renderer.java +++ b/src/org/apache/fop/render/Renderer.java @@ -13,7 +13,8 @@ import org.apache.fop.area.inline.*; import org.apache.fop.layout.FontInfo; import org.apache.fop.fo.FOUserAgent; -import org.apache.log.Logger; +// Avalon +import org.apache.avalon.framework.logger.Logger; // Java import java.io.OutputStream; diff --git a/src/org/apache/fop/render/RendererContext.java b/src/org/apache/fop/render/RendererContext.java index 3706935aa..911c9baab 100644 --- a/src/org/apache/fop/render/RendererContext.java +++ b/src/org/apache/fop/render/RendererContext.java @@ -8,8 +8,6 @@ package org.apache.fop.render; import org.apache.fop.fo.FOUserAgent; -import org.apache.log.Logger; - import java.util.HashMap; /** diff --git a/src/org/apache/fop/render/XMLHandler.java b/src/org/apache/fop/render/XMLHandler.java index f734efc1f..1bdf05729 100644 --- a/src/org/apache/fop/render/XMLHandler.java +++ b/src/org/apache/fop/render/XMLHandler.java @@ -7,8 +7,6 @@ package org.apache.fop.render; -import org.apache.log.Logger; - import org.w3c.dom.Document; /** diff --git a/src/org/apache/fop/render/pdf/PDFXMLHandler.java b/src/org/apache/fop/render/pdf/PDFXMLHandler.java index 521c09fd3..d5d2e5166 100644 --- a/src/org/apache/fop/render/pdf/PDFXMLHandler.java +++ b/src/org/apache/fop/render/pdf/PDFXMLHandler.java @@ -15,8 +15,6 @@ import org.apache.fop.svg.*; import org.apache.fop.svg.SVGUserAgent; import org.apache.fop.layout.FontState; -import org.apache.log.Logger; - import org.apache.batik.dom.util.DOMUtilities; import org.w3c.dom.Document; diff --git a/src/org/apache/fop/render/ps/PSRenderer.java b/src/org/apache/fop/render/ps/PSRenderer.java index 297d4c275..10c08bb06 100644 --- a/src/org/apache/fop/render/ps/PSRenderer.java +++ b/src/org/apache/fop/render/ps/PSRenderer.java @@ -26,8 +26,6 @@ import org.apache.batik.gvt.renderer.*; import org.apache.batik.gvt.filter.*; import org.apache.batik.gvt.event.*; -import org.apache.log.Logger; - // SVG import org.w3c.dom.svg.SVGSVGElement; import org.w3c.dom.svg.SVGDocument; diff --git a/src/org/apache/fop/render/xml/XMLRenderer.java b/src/org/apache/fop/render/xml/XMLRenderer.java index 8e9218eea..94ef5b1d2 100644 --- a/src/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/org/apache/fop/render/xml/XMLRenderer.java @@ -21,7 +21,8 @@ import org.apache.fop.fo.FOUserAgent; import org.apache.fop.layout.FontInfo; import org.apache.fop.apps.FOPException; -import org.apache.log.Logger; +// Avalon +import org.apache.avalon.framework.logger.Logger; // Java import java.io.IOException; diff --git a/src/org/apache/fop/render/xml/XMLXMLHandler.java b/src/org/apache/fop/render/xml/XMLXMLHandler.java index c1174503a..b0fc95882 100644 --- a/src/org/apache/fop/render/xml/XMLXMLHandler.java +++ b/src/org/apache/fop/render/xml/XMLXMLHandler.java @@ -11,8 +11,6 @@ import org.apache.fop.fo.FOUserAgent; import org.apache.fop.render.XMLHandler; import org.apache.fop.render.RendererContext; -import org.apache.log.Logger; - import org.apache.batik.dom.util.DOMUtilities; import org.w3c.dom.Document; diff --git a/src/org/apache/fop/svg/SVGUserAgent.java b/src/org/apache/fop/svg/SVGUserAgent.java index cbd4af29d..210cf049f 100644 --- a/src/org/apache/fop/svg/SVGUserAgent.java +++ b/src/org/apache/fop/svg/SVGUserAgent.java @@ -9,8 +9,6 @@ package org.apache.fop.svg; import org.apache.fop.fo.FOUserAgent; -import org.apache.log.Logger; - import org.apache.batik.bridge.*; import org.apache.batik.swing.svg.*; import org.apache.batik.swing.gvt.*; @@ -19,6 +17,8 @@ import org.apache.batik.gvt.renderer.*; import org.apache.batik.gvt.filter.*; import org.apache.batik.gvt.event.*; +import org.apache.avalon.framework.logger.Logger; + import org.w3c.dom.*; import org.w3c.dom.svg.*; import org.w3c.dom.css.*; diff --git a/src/org/apache/fop/tools/AreaTreeBuilder.java b/src/org/apache/fop/tools/AreaTreeBuilder.java index 0f1529643..330924926 100644 --- a/src/org/apache/fop/tools/AreaTreeBuilder.java +++ b/src/org/apache/fop/tools/AreaTreeBuilder.java @@ -20,10 +20,8 @@ import org.apache.fop.layout.FontInfo; import org.apache.fop.layout.FontState; import org.apache.fop.fo.FOUserAgent; -import org.apache.log.*; -import org.apache.log.format.*; -import org.apache.log.output.io.*; -import org.apache.log.output.*; +import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.avalon.framework.logger.Logger; import java.io.*; import java.util.*; @@ -51,7 +49,7 @@ import org.apache.batik.dom.util.DOMUtilities; * out of order rendering */ public class AreaTreeBuilder { - private Logger log; + private Logger log = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG); /** */ @@ -62,22 +60,6 @@ public class AreaTreeBuilder { System.exit(0); } - public AreaTreeBuilder() { - setupLogging(); - } - - private void setupLogging() { - Hierarchy hierarchy = Hierarchy.getDefaultHierarchy(); - PatternFormatter formatter = new PatternFormatter("[%{priority}]: %{message}\n%{throwable}"); - - LogTarget target = null; - target = new StreamTarget(System.out, formatter); - - hierarchy.setDefaultLogTarget(target); - log = hierarchy.getLoggerFor("test"); - log.setPriority(Priority.DEBUG); - } - /** * */ diff --git a/src/org/apache/fop/tools/TestConverter.java b/src/org/apache/fop/tools/TestConverter.java index 846c5773c..aa03fe57c 100644 --- a/src/org/apache/fop/tools/TestConverter.java +++ b/src/org/apache/fop/tools/TestConverter.java @@ -10,10 +10,8 @@ package org.apache.fop.tools; import org.apache.fop.apps.*; import org.apache.fop.configuration.*; -import org.apache.log.*; -import org.apache.log.format.*; -import org.apache.log.output.io.*; -import org.apache.log.output.*; +import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.avalon.framework.logger.Logger; import java.io.*; import java.util.*; @@ -88,16 +86,7 @@ public class TestConverter { } private void setupLogging() { - Hierarchy hierarchy = Hierarchy.getDefaultHierarchy(); - PatternFormatter formatter = new PatternFormatter( - "[%{priority}]: %{message}\n%{throwable}" ); - - LogTarget target = null; - target = new StreamTarget(System.out, formatter); - - hierarchy.setDefaultLogTarget(target); - log = hierarchy.getLoggerFor("test"); - log.setPriority(Priority.ERROR); + log = new ConsoleLogger(ConsoleLogger.LEVEL_ERROR); } public void setOutputPDF(boolean pdf) { diff --git a/src/org/apache/fop/tools/anttasks/Fop.java b/src/org/apache/fop/tools/anttasks/Fop.java index 276c260c6..62a68f2d1 100644 --- a/src/org/apache/fop/tools/anttasks/Fop.java +++ b/src/org/apache/fop/tools/anttasks/Fop.java @@ -11,11 +11,6 @@ package org.apache.fop.tools.anttasks; import org.apache.tools.ant.*; import org.apache.tools.ant.types.FileSet; -import org.apache.log.*; -import org.apache.log.format.*; -import org.apache.log.output.io.*; -import org.apache.log.output.*; - // SAX import org.xml.sax.XMLReader; import org.xml.sax.InputSource; @@ -35,6 +30,10 @@ import org.apache.fop.apps.Driver; import org.apache.fop.apps.FOPException; import org.apache.fop.configuration.Configuration; +// Avalon +import org.apache.avalon.framework.logger.ConsoleLogger; +import org.apache.avalon.framework.logger.Logger; + /** * Wrapper for Fop which allows it to be accessed from within an Ant task. * Accepts the inputs: @@ -194,25 +193,7 @@ class FOPTaskStarter extends Starter { FOPTaskStarter(Fop task) throws FOPException { this.task = task; - Hierarchy hierarchy = Hierarchy.getDefaultHierarchy(); - // PatternFormatter formatter = new PatternFormatter( - // "[%{priority}] %{category}: %{message}\n%{throwable}" ); - PatternFormatter formatter = new PatternFormatter("%{message}\n%{throwable}"); - - LogTarget target = null; - boolean doConsoleLogging = true; - if (doConsoleLogging) { - target = new StreamTarget(System.out, formatter); - } else { - try { - File f = new File("fop.log"); - target = new FileTarget(f, false, formatter); - } catch (IOException e) {} - } - - hierarchy.setDefaultLogTarget(target); - log = hierarchy.getLoggerFor("fop"); - log.setPriority(Priority.INFO); + log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); } private int determineRenderer(String format) { |