Hi,
On Mon, Sep 14, 2009 at 3:05 PM, Daniel Wilson
<[email protected]> wrote:
> OK, reading that page you linked now. Isn't JUL what I had set up within
> the LoggingObject before the recent changes?
Yes. The difference is that now you can do the logging configuration
in your client application instead of within PDFBox. This is very
useful for downstream projects.
> I guess I need to know how to make my application specify a logging
> configuration.
The easiest way with JUL is to add a logging configuration file and
point the application to it using the "java.util.logging.config.file"
system property. If you need more control, you can use the JUL API in
your application to set up logging.
> I also find that, when running the regression tests, just letting JUnit
> capture all the logged stuff and dump it to stdout is not very helpful.
See below for a simple patch that should direct all PDFBox test logs
to a target/pdfbox.log file.
BR,
Jukka Zitting
Index: logging.properties
===================================================================
--- logging.properties (Revision 0)
+++ logging.properties (Revision 0)
@@ -0,0 +1,5 @@
+handlers=java.util.logging.FileHandler
+.level=DEBUG
+
+java.util.logging.FileHandler.pattern = target/pdfbox.log
+java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
Eigenschaftsänderungen: logging.properties
___________________________________________________________________
Hinzugefügt: svn:eol-style
+ native
Index: build.xml
===================================================================
--- build.xml (Revision 814594)
+++ build.xml (Arbeitskopie)
@@ -265,6 +265,7 @@
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-Xms512M"/>
<sysproperty
key="org.apache.pdfbox.util.TextStripper.file" value="${file}"/>
+ <sysproperty key="java.util.logging.config.file"
value="logging.properties"/>
<classpath>
<pathelement path="${junit.jar}" />
<pathelement path="${ant.jar}" />
@@ -290,6 +291,7 @@
<jvmarg value="-Xms512M"/>
<sysproperty
key="org.apache.pdfbox.util.TextStripper.file" value="${file}"/>
+ <sysproperty key="java.util.logging.config.file"
value="logging.properties"/>
<classpath>
<pathelement path="${junit.jar}" />
<pathelement path="${ant.jar}" />
@@ -311,6 +313,7 @@
<target name="test-junit" depends="clean,compile"
description="run junit tests">
<junit printsummary="off" fork="on" dir=".">
+ <sysproperty key="java.util.logging.config.file"
value="logging.properties"/>
<classpath>
<pathelement path="${junit.jar}" />
<pathelement path="${ant.jar}" />