Differences between revisions 1 and 2
Revision 1 as of 2006-10-25 07:59:35
Size: 1590
Comment: Minimal logging setup for JDK logging for FOP
Revision 2 as of 2009-09-20 23:52:41
Size: 1592
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
Apache FOP version 0.90 and later use [http://jakarta.apache.org/commons/logging/ Apache Jakarta Commons Logging] as the logging API which allows logging to any logging backend (Log4J, JDK logging etc.). Please check the Commons Logging documentation and the documentation of your preferred logging backend for any details. Apache FOP version 0.90 and later use [[http://jakarta.apache.org/commons/logging/|Apache Jakarta Commons Logging]] as the logging API which allows logging to any logging backend (Log4J, JDK logging etc.). Please check the Commons Logging documentation and the documentation of your preferred logging backend for any details.

This page shows how you set up logging in FOP via java.util.logging (JDK 1.4 and later).

Introduction

Apache FOP version 0.90 and later use Apache Jakarta Commons Logging as the logging API which allows logging to any logging backend (Log4J, JDK logging etc.). Please check the Commons Logging documentation and the documentation of your preferred logging backend for any details.

Step by step

1. Create a logging configuration file

There's an example file you can start from in your JDK/JRE: jre/lib/logging.properties. You can copy this file any modify it as you wish.

Here's an minimal example logging.properties that logs to the console:

handlers= java.util.logging.ConsoleHandler

java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

.level= INFO

# Well, the following line actually dances a little out of line :-(
FOP.level = INFO

# This sets all FOP logging to INFO. Only rendering information is logged on the FINE level.
org.apache.fop.level = INFO
org.apache.fop.render.level = FINE

2. Tell java.util.logging to use your configuration file

Set the following system property when you start the JVM:

-Djava.util.logging.config.file=C:/Dev/FOP/logging.properties

That's already it. If you're on J2SE 1.4 or later Commons Logging is used automatically if you don't have Log4J in your classpath. If you want to do some more fancy, please check the Commons Logging documentation.

HowTo/SetupJDK14Logging (last edited 2009-09-20 23:52:41 by localhost)