how to configure log4j logging for Ant FOP task?
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 65
- Joined: Fri Jan 18, 2008 5:54 pm
how to configure log4j logging for Ant FOP task?
Post by Ron Van den Branden »
Hi,
I have trouble getting logging right for an ANT transformation scenario that invokes a FOP task. Consider this simple Ant task:
...when I execute this with following jars on the classpath:
I'm getting following output for the Ant task in the transformation output pane:
However, if I remove the ${oxygenHome}/lib/log4j.jar from the classpath, I am getting all regular FOP output in the transformation output pane.
Yet, I'm not sure if ${oxygenHome}/lib/log4j.jar is the recommended way of controlling logging in an Oxygen transformation scenario. If so, how should I configure log4j logging properly for ${oxygenHome}/lib/xmlgraphics-commons-2.1.jar (which is containing the org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry class)?
Best,
Ron
I have trouble getting logging right for an ANT transformation scenario that invokes a FOP task. Consider this simple Ant task:
Code: Select all
<target name="transform-pdf">
<fop format="application/pdf"
fofile="test.fo"
outfile="test.pdf"
messagelevel="debug"/>
</target>
Code: Select all
${oxygenHome}/lib/fop.jar
${oxygenHome}/lib/batik-all-1.8.jar
${oxygenHome}/lib/commons-logging-1.2.jar
${oxygenHome}/lib/avalon-framework-api-4.3.1.jar
${oxygenHome}/lib/avalon-framework-impl-4.3.1.jar
${oxygenHome}/lib/commons-io-1.3.1.jar
${oxygenHome}/lib/xmlgraphics-commons-2.1.jar
${oxygenHome}/lib/log4j.jar
Code: Select all
transform-pdf:
[fop] log4j:WARN No appenders could be found for logger (org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry).
[fop] log4j:WARN Please initialize the log4j system properly.
Yet, I'm not sure if ${oxygenHome}/lib/log4j.jar is the recommended way of controlling logging in an Oxygen transformation scenario. If so, how should I configure log4j logging properly for ${oxygenHome}/lib/xmlgraphics-commons-2.1.jar (which is containing the org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry class)?
Best,
Ron
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: how to configure log4j logging for Ant FOP task?
Hi,
e.g. log4j.properties that logs everything on debug.
Normally just placing the log4j.properties file in the working directory, or the classpath folder works, but I found this is not the case with ANT.
So the easiest way I found for an ANT scenario is to keep the log4j.properties file in the same folder as the ant build file (or the file associated with the scenario), edit the ANT scenario and in the JVM Arguments specify this Java system property:
Regards,
Adrian
log4j also needs a configuration file, usually named log4j.properties. That's why you get that "log4j:WARN Please initialize the log4j system properly." message.However, if I remove the ${oxygenHome}/lib/log4j.jar from the classpath, I am getting all regular FOP output in the transformation output pane.
e.g. log4j.properties that logs everything on debug.
Code: Select all
log4j.rootCategory=DEBUG, R
# R is the standard output
log4j.appender.R=org.apache.log4j.ConsoleAppender
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%r %p [ %t ] %c - %m%n
So the easiest way I found for an ANT scenario is to keep the log4j.properties file in the same folder as the ant build file (or the file associated with the scenario), edit the ANT scenario and in the JVM Arguments specify this Java system property:
Code: Select all
-Dlog4j.configuration=${cfdu}/log4j.properties
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 65
- Joined: Fri Jan 18, 2008 5:54 pm
Re: how to configure log4j logging for Ant FOP task?
Post by Ron Van den Branden »
Hi Adrian,
Thanks for your help.
Could it be that the mentioned class is misconfigured somehow and in its current form incompatible with log4j?
Best,
Ron
Thanks for your help.
Unfortunately, this doesn't change the log output:Normally just placing the log4j.properties file in the working directory, or the classpath folder works, but I found this is not the case with ANT.
So the easiest way I found for an ANT scenario is to keep the log4j.properties file in the same folder as the ant build file (or the file associated with the scenario), edit the ANT scenario and in the JVM Arguments specify this Java system property:Code: Select all
-Dlog4j.configuration=${cfdu}/log4j.properties
Code: Select all
[fop] log4j:WARN No appenders could be found for logger (org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry).
[fop] log4j:WARN Please initialize the log4j system properly.
Best,
Ron
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: how to configure log4j logging for Ant FOP task?
Hi,
Check in the Java command line from transformation output log, you should find it after the -Xmx value.
Regards,
Adrian
That means it's not seeing the log4j.configuration system property.Unfortunately, this doesn't change the log output:
Check in the Java command line from transformation output log, you should find it after the -Xmx value.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 65
- Joined: Fri Jan 18, 2008 5:54 pm
Re: how to configure log4j logging for Ant FOP task?
Post by Ron Van den Branden »
Hi Adrian,
Ahh, I had put the -Dlog4j.configuration argument in the wrong place: "Additional arguments" instead of "JVM Arguments".
My bad, I can confirm it works perfectly if I accurately follow your earlier instructions and add the reference to the log4j properties file under "JVM Arguments".
Problem solved, many thanks!
Ron
Ahh, I had put the -Dlog4j.configuration argument in the wrong place: "Additional arguments" instead of "JVM Arguments".
My bad, I can confirm it works perfectly if I accurately follow your earlier instructions and add the reference to the log4j properties file under "JVM Arguments".
Problem solved, many thanks!
Ron
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service