(comments inline below)

On 16.11.2007 01:06:08 Andreas L Delmelle wrote:
<snip/>
> Probably the better way for FOP (well, it's a start):
> -> implement a more generic org.apache.fop.apps.Log, that raises  
> events on an associated Listener
> -> set the above config attribute on LogFactory prior to doing  
> anything else, except
> -> offer the user a hook to plug in a custom event handler

Please note that this is something that will be addressed in the next
few months (it's going up in my priority list). I don't like just piping
log output to the user/caller. I have different ideas that should
address the needs better than just a massive stream of log output. I
like to differentiate between information for the FOP developer (logging)
and for the FOP user (processing feedback). Please track the following
Wiki page:
http://wiki.apache.org/xmlgraphics-fop/ProcessingFeedback
I'm probably getting to that in December or January at which point I'll
initiate a serious design discussion.

> The Log instance that raises the events should ideally be tied to the  
> FOUserAgent.
> 
> Still unsure how to fit in the static loggers :/
> Maybe, to minimize the amount of refactoring, FTM we could do:
> -> implement a simple org.apache.fop.apps.StaticLog
> -> initialize all static loggers in static blocks and call  
> LogFactory.setAttribute() to use this type
> 
> The StaticLog.info() events and above, could get overloads that  
> accept an instance-based logger (the one tied to the user agent) on  
> which they register those events.
> Should you decide to take steps in this direction, since this is  
> becoming a rather pressing matter, IMO, I'm willing to invest some  
> time in this as well.

For a client, I've hacked together something using ThreadLocals in Log4J
so you can grab all log output per rendering run (as long as we don't do
multi-threading inside FOP).

http://www.jeremias-maerki.ch/download/fop/log4j-threadlocal-appender.zip

You just have to implement ThreadLocalLogInterceptor to get the log
output. One instance per rendering run. Before you call FOP, you call
ThreadLocalLogSetup.installLogIntercepter() with your interceptor
instance in the same thread that you will run FOP. After the rendering
run, uninstall it again using ThreadLocalLogSetup.uninstallLogIntercepter().

This only works for Log4J so you have to configure Commons Logging to
use Log4J. But this could easily be adapted to work with Commons Logging
directly. But maybe that helps as a work-around until we have a proper
processing feedback mechanism.

Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to