Heinzer David <heinzer.david <at> wanadoo.fr> writes:
>
> Thanks a lot everybody for your help ! :)
> Now, with all your advises, I will try to resolve my problem... :)
> It's right log4j is very powerful, I made some examples to understand its use,
> it's relatively easy. But if I understand well, with FOP, the only thing to do
> is to configure the ouput display with configuration of Jakarta, the "abstract
> layer" between FOP and , by example, log4j.
>
> Arturo, if you always agree, I will be interesting for your code.
> I thank you in advance.
>
> Best regards
>
> Heinzer David
> heinzer.david AT wanadoo.fr
>
Here's what I do:
// this part goes just before you start the FOP rendering process
Logger fopLogger = Logger.getLogger("org.apache.fop");
NullOutputStream errorOutput = new NullOutputStream();
Appender errorAppender =
new WriterAppender(new ActionErrorLayout(errors, infoMsgs), errorOutput);
fopLogger.addAppender(errorAppender);
// this class converts the LoggingEvent into Struts ActionMessage.
class ActionErrorLayout extends Layout {
ActionErrors errors;
ActionMessages messages;
public ActionErrorLayout(ActionErrors errors, ActionMessages infoMsgs) {
this.errors = errors;
this.messages = infoMsgs;
}
public String format(LoggingEvent arg0) {
if (arg0.getLevel() == org.apache.log4j.Level.ERROR) {
ActionError nextError = new ActionError("error.SAXErrorWrapper",
arg0.getMessage());
errors.add(ActionErrors.GLOBAL_ERROR, nextError);
} else {
ActionMessage nextMsg = new ActionMessage("error.SAXErrorWrapper",
arg0.getMessage());
messages.add(ActionMessages.GLOBAL_MESSAGE, nextMsg);
}
return "";
}
public boolean ignoresThrowable() {
return true;
}
public void activateOptions() {
}
}
HTH,
arturo
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]