If you are using pre FOP .20.x do: 
   MessageHandler.setOutputMethod( MessageHandler.NONE );
otherwise do this:
 
import org.apache.log.*;
import org.apache.log.output.io.FileTarget;
import org.apache.log.output.io.StreamTarget;
import org.apache.log.format.PatternFormatter;
 
 
In your class variables add:
private static Logger         mApachelog;
 
 
call in you servlet init method:
private void initializeApacheFopLog()   
{
  try
  {
   MessageHandler.setOutputMethod( MessageHandler.NONE );
   Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
   PatternFormatter formatter = new PatternFormatter("[%{priority}]:  %{context}  %{message}\n%{throwable}" );
   File logFile = new File("logs/fop.log");
   LogTarget target = new FileTarget(logFile, false, formatter);
   hierarchy.setDefaultLogTarget(target);
   mApachelog = hierarchy.getLoggerFor("fop");
   mApachelog.setPriority(Priority.getPriorityForName("ERROR"));  <=== can be DEBUG, INFO, WARN, ERROR, FATAL_ERROR.  I pass the value via a servlet init parameter.
  }
  catch (Exception e)
  {
   System.err.println("Can't initialize FOP log: " + e.toString());
  }
}
 
In your rendering method:
 
   Driver driver = new Driver();
   driver.setLogger(mApachelog);            <++++++++ add this line
   driver.setRenderer(driver.RENDER_PDF);
 
Jim
-----Original Message-----
From: Anshuman [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 9:11 AM
To: [EMAIL PROTECTED]
Subject: Debug message on server console and setting the fonts correctly...

Hi !,
   
    I have two questions for which I am seeking response.
 
    1) Every time I run the Servlet example to create an PDF, I get the message on server as below:
        WARNING: defaulted font to any,normal,normal
        WARNING: unknown font sans-serif,bold,normal so defaulted font to any
        WARNING: defaulted font to any,normal,normal
        WARNING: unknown font sans-serif,bold,normal so defaulted font to any
        WARNING: defaulted font to any,normal,normal
        WARNING: unknown font sans-serif,bold,normal so defaulted font to any
        WARNING: defaulted font to any,normal,normal
        WARNING: unknown font sans-serif,bold,normal so defaulted font to any
        WARNING: defaulted font to any,normal,normal
        WARNING: unknown font sans-serif,bold,normal so defaulted font to any
        WARNING: defaulted font to any,normal,normal
        WARNING: unknown font sans-serif,bold,normal so defaulted font to any
        >]
        Parsing of document complete, stopping renderer
        Initial heap size: 39301Kb
        Current heap size: 38974Kb
        Total memory used: -327Kb
          Memory use is indicative; no GC was performed
          These figures should not be used comparatively
        Total time used: 571ms
        Pages rendererd: 1
 
            Is there any configuration to stop there messages to be displayed on the server console.
 
        2) I am not setting the font as sans-serif, still I get this message. Can any one help me in setting the fonts properly.
 
 
with regards,
ASM

Reply via email to