diff options
author | Keiron Liddle <keiron@apache.org> | 2002-04-11 09:33:31 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2002-04-11 09:33:31 +0000 |
commit | ec28e0fccd19e6dcd0aef8aefad945d9dfafaa8c (patch) | |
tree | 034d05290379d4b556f2473ea82618b5bd9d429f /src | |
parent | fcc06083c6b4f75a5a6ebbcc535f3dc2e95c88f4 (diff) | |
download | xmlgraphics-fop-ec28e0fccd19e6dcd0aef8aefad945d9dfafaa8c.tar.gz xmlgraphics-fop-ec28e0fccd19e6dcd0aef8aefad945d9dfafaa8c.zip |
replaced logkit logger with the logger interface in avalon framework
Submitted by: Michael Gratton <mjg@recalldesign.com>
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194733 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
25 files changed, 57 insertions, 130 deletions
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) { |