[EMAIL PROTECTED] wrote:

I tried that, it logs well. But I would like to have the log written to
file.

It's a litle bit convolute due to two Logger classes in different packages, but anyway here is an example using logkit:


//Set up logkit logger
Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
try {
        LogTarget target = new FileTarget(
                new File("d:/fop.log"),
                false, new PatternFormatter("[%{priority}]: 
%{message}\n%{throwable}"));
        hierarchy.setDefaultLogTarget(target);
} catch (IOException e) {
        //Ok, use default log target
        ...
}
org.apache.log.Logger logger = hierarchy.getLoggerFor("fop");
logger.setPriority(Priority.DEBUG);

//Wrap it into avalon logger
org.apache.avalon.framework.logger.Logger log = new LogKitLogger(logger);
//Register it at FOP
MessageHandler.setScreenLogger(log);
driver.setLogger(log);

--
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel



Reply via email to