You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by ruchika thakur <ru...@gmail.com> on 2006/10/25 09:43:34 UTC

Logging in fop 0.9

Hello,

I am using fop 0.9. I am not sure if in fop 0.9 i can get log messages while
the pdf is being rendered, as we get in fop 0.2. In fop 0.2 i use to set
driver.setLogger(log), to get the log messages. But how do i do it in fop0.9
.
Please suggest.

Once i have set up say log4j and used commong-logging, but how would i give
this logger to fop . Like in fop 0.5 we use to have the following code with
driver.setLogger(loggger);

Driver driver = new Driver(foSource, l_baOutStream);
driver.setLogger(loggger);
driver.setRenderer(Driver.RENDER_PDF);
driver.run();

Below are the log messages which i used to get in fop 0.2

[INFO]: Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO]: building formatting object tree
[INFO]: setting up fonts
[INFO]: [1]
[INFO]: [2]
[DEBUG]: Last page-sequence produced 2 pages.
[INFO]: [3]
[INFO]: [4]
[INFO]: [5]
[INFO]: [6]
[INFO]: [7]
[INFO]: [8]
[DEBUG]: Last page-sequence produced 6 pages.
[INFO]: Parsing of document complete, stopping renderer
[DEBUG]: Initial heap size: 122162Kb
[DEBUG]: Current heap size: 101839Kb
[DEBUG]: Total memory used: -20322Kb
[DEBUG]: Memory use is indicative; no GC was performed
[DEBUG]: These figures should not be used comparatively


But with fop 0.9, below is how pdf is being rendered. In this code how do i
set logger so that fop messages are redirected to log4j

// configure foUserAgent as desired
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
fopFactory.setStrictValidation(false);

// Construct fop with desired output format
Fop fop =fopFactory.newFop(MimeConstants.MIME_PDF
,foUserAgent,l_baOutStream);

// Setup JAXP using identity transformer
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();

// Resulting SAX events (the generated FO) must be piped through to FOP
Result res = new SAXResult(fop.getDefaultHandler());

// Start XSLT transformation and FOP processing
transformer.transform(foSource, res);

Best Regards,
Ruchika