[Posting back to fop-user so everyone profits. I hope you don't mind.]

I quickly copied your LogKit setup code to a test class (attached) and
tried it. Worked fine. You sure you're looking at the right file? Your
logfile lands in the "current" directory whereever that is. Try
switching to the ConsoleLogger to see if there's log output at all.

On 17.04.2003 16:52:38 Christophe BESSON wrote:
> Thanks a lot for your help.
> The screen logger is now setted but my log file is always empty! Any idea ?
> 
> Christophe BESSON.
> 
> -----Message d'origine-----
> De: Jeremias Maerki
> A: [EMAIL PROTECTED]
> Date: 17/04/03 16:11
> Objet: Re: [FOP 0.20.4] I have some problems with logs
> 
> A little line is missing. See inline.
> 
> On 17.04.2003 11:30:58 Christophe BESSON wrote:
> > I use FOP 0.20.4 to generate PDF into a servlet and I have some
> problems
> > with logs. first, I have a message into the console of Tomcat that
> says :
> > [WARNING] Screen logger not set. And when I generate the PDF with FOP,
> I
> > have no logs into the file I specified : my log file is created but is
> > empty.
> > 
> > The PDF file is well created.
> > 
> > Here is the source code of a part of my servlet : 
> > 
> >     private byte[] renderXML(File xmlFile, String pathXslFile) throws
> > MyException { 
> >         File xslFile = new File(pathXslFile); 
> >         XSLTInputHandler input = new XSLTInputHandler(xmlFile,
> xslFile); 
> >         try { 
> >             ByteArrayOutputStream out = new ByteArrayOutputStream(); 
> > 
> >             Driver driver = new Driver(); 
> >             org.apache.log.Logger log; 
> >             log =
> > org.apache.log.Hierarchy.getDefaultHierarchy().getLoggerFor("fop"); 
> >                 org.apache.log.format.PatternFormatter formatter = new
> > org.apache.log.format.PatternFormatter(pattern); 
> >             try { 
> >                  org.apache.log.output.io.FileTarget fileTarget = new
> > org.apache.log.output.io.FileTarget(new File("myLogFile.log"), false,
> > formatter);
> > 
> >                  log.setLogTargets(new
> > org.apache.log.LogTarget[]{fileTarget}); 
> >             } catch (IOException ex) { 
> >                  ... 
> >             } 
> >  
> > log.setPriority(org.apache.log.Priority.getPriorityForName("DEBUG")); 
> 
> This should be:
>               org.apache.avalon.framework.logger.Logger avlog = 
>                   new
> org.apache.avalon.framework.logger.LogKitLogger(log);
>               MessageHandler.setScreenLogger(avlog); //<-- missing!!!
>               driver.setLogger(avlog);
> 
> >             driver.setLogger(new
> > org.apache.avalon.framework.logger.LogKitLogger(log)); 
> >             driver.setRenderer(Driver.RENDER_PDF); 
> >             driver.setOutputStream(out); 
> > 
> >             driver.render(input.getParser(), input.getInputSource()); 
> > 
> >             return out.toByteArray(); 
> > 
> >         } catch (Exception ex) { 
> >             ... 
> >         } 
> >     } 
> > 
> > Where is the problem, please ? 


Jeremias Maerki

Attachment: LogKitTest.java
Description: Binary data

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

Reply via email to