Logging with Java

Hello,

in my Notes Agent, I am using Apache FOP 0.20.5 to convert xml files to pdf. In the sample java files, Apache uses a logger to log messages to the console or a file. I would like to log the messages to a Notes Database.

Does anybody know how the logger must be modified to be able to log to a Notes Database?

This is how Apache logs:

//Avalon

import org.apache.avalon.framework.ExceptionUtil;

import org.apache.avalon.framework.logger.ConsoleLogger;

import org.apache.avalon.framework.logger.Logger;

//FOP

import org.apache.fop.apps.Driver;

import org.apache.fop.apps.FOPException;

import org.apache.fop.messaging.MessageHandler;

public class ExampleXML2PDF extends AgentBase

{

public void convertXML2PDF(File xml, File xslt, File pdf) 

            throws IOException, FOPException, TransformerException {

    //Construct driver

    Driver driver = new Driver();

    

    //Setup logger

    Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);

    driver.setLogger(logger);

    MessageHandler.setScreenLogger(logger);



    driver.setRenderer(Driver.RENDER_PDF);

}

Many thanks in advance!

Beate

Subject: Logging with Java

I’m not familar with how Apache does their logging but I have written a solution for Notes DB logging that you could use, see below.

From a previous post;

The technique I use is a custom class that is similar to the NotesLog. This class creates

a trace document in the database where the agent runs and logs all the “LogMsg” calls you put

in your agent. In the free download listed below (use TraceLog22.ntf) you’ll find a JavaTraceLog script library and a basic Java agent that shows how to use the JavaTraceLog class.

HTH,

http://www.eview.com/eview/viewr5.nsf/0/d5e78ab6f111a37f85256e9f004440d7?OpenDocument

Subject: RE: Logging with Java

Hello Michael,

sorry, this is not what I am looking for. But I have found the answer. In order to make avalon log to a Notes Database, I must create a class that implements org.apache.avalon.framework.logging.Logger and set it on the Driver object.

Thank you!

Beate