Call FOP with Debug Logging

Q

How to turn on debug logging when running the FOP command? I want to get more information to troubleshoot a problem with my FO file.

✍: FYIcenter.com

A

If want to turn on debug logging when running the FOP command to help troubleshooting FO file issues, you can follow this tutorial.

1. Modify the fop.bat file to turn on debug logging:

fyicenter> cd \local\fop-2.2\fop

fyicenter> copy fop.bat fop-original.bat

fyicenter> edit fop.bat
   ...
   set LOGCHOICE=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
   ...
   set LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=debug
   ... 

2. Run FOP command and redirect the error output to a log file:

fyicenter> fop examples\fo\basic\simple.fo \temp\simple.pdf
   2> \temp\simple.log

3. Open the log file to review log messages:

[DEBUG] ImageImplRegistry - Registered org.apache.fop.image.loader.batik.PreloaderWMF with priority 1000
...
[DEBUG] ContentHandlerFactoryRegistry - Dynamically adding 
   ContentHandlerFactory: org.apache.fop.render.afp.extensions.AFPExtensionHandlerFactory
...
[DEBUG] FOP - target-resolution set to: 72.0dpi (px2mm=0.35277778)
[DEBUG] FOP - userconfig is null
...
[DEBUG] FontInfo - Registering: sans-serif,normal,400 under F1
[DEBUG] FontInfo - Registering: sans-serif,oblique,400 under F2
[DEBUG] FontInfo - Registering: sans-serif,italic,400 under F2
[DEBUG] FontInfo - Registering: sans-serif,normal,700 under F3
[DEBUG] FontInfo - Registering: sans-serif,oblique,700 under F4
[DEBUG] FontInfo - Registering: sans-serif,italic,700 under F4
...
[DEBUG] IFRenderer - Rendering areas via IF document handler 
   (org.apache.fop.render.intermediate.EventProducingFilter)...
[DEBUG] FOTreeBuilder - Building formatting object tree
[DEBUG] AreaTreeHandler - Current heap size: 7346KB
[DEBUG] BidiResolver - BD: RESOLVE: org.apache.fop.fo.pagination.PageSequence@14a2528[@id=]
...
[DEBUG] BidiResolver - BD: RESOLVE: RANGES:
[DEBUG] BidiResolver - DR: block { <Extensible Markup Language (XML) 1.0>, 
   intervals <T[0,36][0](-1)> }
[DEBUG] BidiResolver - DR: block { <>, intervals <> }
[DEBUG] BidiResolver - DR: block { <The Extensible Markup Language (XML) is a subset ...
[DEBUG] BidiResolver - DR: flow { <>, intervals <> }
[DEBUG] BidiResolver - DR: page-sequence { <>, intervals <> }
... 
[DEBUG] PageSequenceLayoutManager - Starting layout
[DEBUG] AbstractPageSequenceLayoutManager - [1]
[DEBUG] AbstractBreaker - PLM> flow BPD =671812
[DEBUG] PageProvider - start of the next element list is: page=1 col=0
[DEBUG] TextLayoutManager - GK: [0,36]
[DEBUG] TextLayoutManager - GK: { index = 0, char = E, level = -1, levelPrev = -1, 
   inWord = false, inSpace = false}
...
[DEBUG] BreakingAlgorithm - Could not find a set of breaking points 1.0
[DEBUG] LineLayoutManager - No set of breaking points found with maxAdjustment = 1.0
[DEBUG] LineLayoutManager - Hyphenation possible? false
[DEBUG] SpaceResolver - ----start space resolution (first=true, last=false)...
[DEBUG] SpaceResolver - ----end space resolution.
[DEBUG] SpaceResolver - ----start space resolution (first=false, last=false)...
...
[INFO] FOUserAgent - Rendered page #1.
[DEBUG] AbstractPageSequenceLayoutManager - page finished: 1, current num: 1
[DEBUG] FOTreeBuilder - endElement for top-level fo:root
[DEBUG] FOTreeBuilder - Parsing of document complete
[DEBUG] AreaTreeHandler - Last page-sequence produced 1 pages.
[DEBUG] PageSequenceLayoutManager - Ending layout
[DEBUG] IDTracker - signalIDProcessed()
[DEBUG] IFRenderer - Rendering finished.
[DEBUG] AreaTreeHandler - Initial heap size: 8219KB
[DEBUG] AreaTreeHandler - Current heap size: 9816KB
[DEBUG] AreaTreeHandler - Total memory used: 1596KB
[DEBUG] AreaTreeHandler - Total time used: 390ms
[DEBUG] AreaTreeHandler - Pages rendered: 1
[DEBUG] AreaTreeHandler - Avg render time: 390ms/page (154pages/min)

 

Convert XML to FO with FOP

Call org.apache.fop.cli.Main in fop.jar

FOP Commands and Examples

⇑⇑ FAQ for FOP (Formatting Object Processor)

2018-04-28, 3409🔥, 0💬