Hello,

I have recently been having issues with this myself. What you need to do is set 
the environment variable FOP_OPTS to set the location of the log4j 
configuration file. In linux, on the command line you would type:

export FOP_OPTS="-Dlog4j.configuration=file:///<location of log4j xml file>"

In windows, I think you:
1) Right click My Computer
2) Advanced Settings
3) Environment Variables button
4) Add the variable FOP_OPTS and give it the value 
"-Dlog4j.configuration=file:///<location of log4j xml file>"
5) Remember to close and re-open the prompt for the changes to take effect.

I have my log4j.xml file located in the base fop directory and configured like 
the following:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" 
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd";>
<log4j:configuration>
    <appender name="console" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout"></layout>
    </appender>
    <appender name="logfile" class="org.apache.log4j.FileAppender">
    <param name="file" value="myFile.log" />
        <layout class="org.apache.log4j.PatternLayout"></layout>
    </appender>
    <logger name="org.apache.fop">
        <level value="warn"/>
        <appender-ref ref="console" />
    </logger>
    <logger name="org.apache.xmlgraphics">
        <level value="warn"/>
        <appender-ref ref="console" />
    </logger>
    <!-- Any specific class log requests e.g.
    <logger name="org.apache.fop.pdf.AbstractPDFStream">
        <level value="debug"/>
        <appender-ref ref="logfile" />
    </logger>
    ...
    -->
    <!-- ALL | DEBUG | INFO | WARN | ERROR | FATAL | OFF -->
    <root>
        <priority value ="debug" />
        <appender-ref ref="console" />
        <appender-ref ref="logfile" />
    </root>
</log4j:configuration>

Then you simply run FOP and it should output the logging from the classes you 
specified to the file. Alternatively, change the org.apache.fop / xmlgraphics 
to the desired logging level and watch it output to the console.

If you are still having issues, please post your full log4j.xml file with any 
reply.

Regards,

Robert Meyer

> Date: Mon, 11 Jun 2012 01:58:47 -0700
> From: webmas...@polymorphisme.org
> To: fop-users@xmlgraphics.apache.org
> Subject: FOP 1.0 and log4j
> 
> 
> Hi,
> 
> I'm working with FOP 1.0 and log4j.
> 
> In my file log4j.xml, I have two loggers :
> 
>    <logger name="org.apache.fop"> 
>     <level value="all"/>  
>     <appender-ref ref="stdout"/>   
>     <appender-ref ref="stdtxt"/>     
>   </logger>   
>    
>   <logger name="org.apache.xmlgraphics"> 
>     <level value="all"/>  
>     <appender-ref ref="stdout"/>   
>     <appender-ref ref="stdtxt"/>     
>   </logger>   
>   
> I have not understand why FOP return some WARN in the console :
> 
> 10:51:28,125 [main] DEBUG [ImageHandlerRegistry] Dynamically adding
> ImageHandler: org.apache.fop.render.afp.AFPImageHandlerRawCCITTFax
> 10:51:28,126 [main] DEBUG [ImageHandlerRegistry] Dynamically adding
> ImageHandler: org.apache.fop.render.afp.AFPImageHandlerSVG
> log4j:WARN No appenders could be found for logger (FOP).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
> more info.
> 10:51:28,190 [main] DEBUG [AbstractConfigurator] userconfig is null
> 10:51:28,251 [main] DEBUG [AbstractConfigurator] userconfig is null
> 
> An idea ? 
> -- 
> View this message in context: 
> http://old.nabble.com/FOP-1.0-and-log4j-tp33991872p33991872.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
> 
                                          

Reply via email to