You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Phill <ph...@theactivitypeople.co.uk> on 2009/04/15 16:00:15 UTC

Redirecting the output from FOP to a log file?

I'm new to java, but I've written a small java service which uses the 
FOP library. Every time FOP generates a PDF, there are a lot of warnings 
spat out on the console. Is there any way I can disable the render 
warnings and then filter any serious messages to a log file?

Re: Redirecting the output from FOP to a log file?

Posted by Andreas Delmelle <an...@telenet.be>.
On 15 Apr 2009, at 16:00, Phill wrote:

Hi

> I'm new to java, but I've written a small java service which uses  
> the FOP library. Every time FOP generates a PDF, there are a lot of  
> warnings spat out on the console. Is there any way I can disable the  
> render warnings and then filter any serious messages to a log file?

In FOP 0.95, you cannot really 'disable' the warnings, unless by  
changing the log-level.
What is definitely possible, is to create your own logger subclass,  
and add the desired behavior in its warn() or error() handler.

Note:
* as FOP uses Jakarta Commons Logging as an abstraction layer, this  
all depends greatly on the actual log implementation that is used  
(Log4J, standard JDK logging...)
* FOP uses static loggers, so if your application possible runs  
multithreaded, you may need to use a ThreadLocal to sort out which  
message comes from which thread (Suggestion: search the fop-users  
archive for "Log4J" and "ThreadLocal", as I am quite sure a similar  
question was answered in the past couple of weeks)

see also: http://xmlgraphics.apache.org/fop/0.95/embedding.html#basic-logging

If you can use FOP Trunk (stable enough for a lot of our users), you  
get a whole new range of possibilities for handling 'events'.
See: http://xmlgraphics.apache.org/fop/trunk/events.html


HTH!

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org