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 Richard Evans <ri...@retek.com> on 2004/07/05 10:36:10 UTC
Detecting errors in rendering
I'm running FOP in a servlet to convert .fo files to PDFs. I need to detect
whether the render job had any errors.
I've tried implementing my own Logger and using Driver.setLogger and this
does catch some errors. However other errors (bad property formats, etc)
seem to be reported via the static 'screen logger'. I don't see how I can
use the screen logger safely in a multi-threaded environment.
Richard
RE: Detecting errors in rendering
Posted by Richard Evans <ri...@retek.com>.
Yes, that does make sense!
Many thanks for the tip.
Richard
-----Original Message-----
From: Chris Bowditch [mailto:bowditch_chris@hotmail.com]
Sent: 05 July 2004 09:50
To: fop-user@xml.apache.org
Subject: Re: Detecting errors in rendering
Richard Evans wrote:
> I've tried implementing my own Logger and using Driver.setLogger and
> this does catch some errors. However other errors (bad property
> formats, etc) seem to be reported via the static 'screen logger'. I
> don't see how I can use the screen logger safely in a multi-threaded
> environment.
The screen logger is set by:
MessageHandler.setScreenLogger(logger);
However, as you've noticed, in a MT environment, the messages for different
threads will be mingled together. The way I solved this problem, was to
create
a logger that can have many listeners which each register with the logger.
The
constructor for each listener records the thread name, and when starting a
new
thread, a new listener is registered with the logger. The logger then passes
its events to registered listeners whose thread name matches the current
thread.
I hope this makes sense.
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: Detecting errors in rendering
Posted by Chris Bowditch <bo...@hotmail.com>.
Richard Evans wrote:
> I’ve tried implementing my own Logger and using Driver.setLogger and
> this does catch some errors. However other errors (bad property
> formats, etc) seem to be reported via the static ‘screen logger’. I
> don’t see how I can use the screen logger safely in a multi-threaded
> environment.
The screen logger is set by:
MessageHandler.setScreenLogger(logger);
However, as you've noticed, in a MT environment, the messages for different
threads will be mingled together. The way I solved this problem, was to create
a logger that can have many listeners which each register with the logger. The
constructor for each listener records the thread name, and when starting a new
thread, a new listener is registered with the logger. The logger then passes
its events to registered listeners whose thread name matches the current thread.
I hope this makes sense.
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org