| |

Lesson 0: Enabling and disabling logging

Lesson objective

The objective of this lesson is to learn how to enable and disable logging, as well as to select one of the various logging systems supported by Ruddi.

Reference material

Source code of reference: LoggingExample.java

Related lessons

This lesson is a base lesson that can be used to enable and disable logging in the sample source code provided with the other lessons.

Review of concepts

Ruddi supports several types of logging systems: a SystemOut logging, a Log4J-based logging as well as an experimental XML-based logging. Logging is defined on a per- UDDIProfile basis, what means that the developer can vary the logging system used depending on the targeted UDDI registry, or even the context of interaction with an UDDI registry (such as testing, for example).

Code snippets

Logging is bound to the notion of UDDIProfile . We create a new UDDIProfile as follows:

UDDIProfile profile = new UDDIProfile();

We then enable logging by setting the inspireit.uddi.logEnabled property to true :

profile.setProperty("inspireit.uddi.logEnabled","true");

By default, SystemOut is the logging system used. With SystemOut , the XML messages exchanged between the Ruddi application and the UDDI registry are written to the standard output. The logging system can be set to the preferred one by defining the inspireit.uddi.logging.provider property appropriately. The following code illustrates how to enable use of the Log4J-based logging system:

profile.setProperty("inspireit.uddi.logging.provider","inspireit.logging.Log4JLogger");

And the following code illustrates how to enable use of the XML-based logging system:

profile.setProperty("inspireit.uddi.logging.provider","inspireit.logging.XMLLogger");

Both the Log4J-based logging system and XML-based one output to a file, respectively the inspireit-uddi.log and inspireit-uddi.xml files in the Ruddi application default directory.

 

 

| |

(c) INSPIRE IT, 2003 | Send us your feedback: developers@ruddi.biz