If you
are using pre FOP .20.x do:
MessageHandler.setOutputMethod( MessageHandler.NONE
);
otherwise do this:
import
org.apache.log.*;
import org.apache.log.output.io.FileTarget; import org.apache.log.output.io.StreamTarget; import org.apache.log.format.PatternFormatter; In your class
variables add:
private static Logger mApachelog; call
in you servlet init method:
private void
initializeApacheFopLog()
{
try { MessageHandler.setOutputMethod( MessageHandler.NONE ); Hierarchy hierarchy = Hierarchy.getDefaultHierarchy(); PatternFormatter formatter = new PatternFormatter("[%{priority}]: %{context} %{message}\n%{throwable}" ); File logFile = new File("logs/fop.log"); LogTarget target = new FileTarget(logFile, false, formatter); hierarchy.setDefaultLogTarget(target); mApachelog = hierarchy.getLoggerFor("fop"); mApachelog.setPriority(Priority.getPriorityForName("ERROR")); <=== can be DEBUG, INFO, WARN, ERROR, FATAL_ERROR. I pass the value via a servlet init parameter. } catch (Exception e) { System.err.println("Can't initialize FOP log: " + e.toString()); } } In
your rendering method:
Driver driver = new
Driver();
driver.setLogger(mApachelog); <++++++++ add this line driver.setRenderer(driver.RENDER_PDF); Jim
|
- Debug message on server console and setting the fonts correctly.... Anshuman
- Jim Urban