Developing exteNd Director Applications

CHAPTER 16

Using the XML and IPDR Logging Providers

This chapter includes instructions for using the XML and IPDR logging providers that ship with exteNd Director.

The chapter has the following sections:

 
Top of page

About the XML and IPDR logging providers

In addition to the standard logging facility, exteNd Director includes two logging providers that let you generate:

For more information    IPDR defines an open, extensible record format for exchanging resource and service usage information. For more information about IPDR, see the IPDR.org Web site.

The behavior of the XML and IPDR logging providers is very similar to the behavior of the standard logging mechanism supported by exteNd Director.

For more information    For details on using the standard logging mechanism, see Logging Information.

To use the XML or the IPDR logging providers, you first need to get the log object, which is an instance of EboLog. To do this you need to use the getLog() method on the EboLogFactory class, as shown below:

  logXML = (EboLog) EboLogFactory.getLog( "XML Test" );
  logIPDR = (EboLog) EboLogFactory.getLog( "IPDR Test" );

You can then add either of the two logging providers by using the addLoggingProvider() method on EboLog.

To add a logging provider object for XML logging, you might use this method call:

  logXML.addLoggingProvider(EboUniqueXMLFileLoggingProvider.class.getName());

To add a logging provider object for IPDR logging, you might use this method call:

  logIPDR.addLoggingProvider(EboUniqueIPDRFileLoggingProvider.class.getName());

Both providers have templates for the log file format, described next. Both kinds of templates should be placed in the FrameworkService-conf directory within the FrameworkService.jar file.

The name of the template can be specified as a tag in the log string. Each variable in the template should also be specified in the log string, unless it is one of the built-in properties:

  logIPDR.audit("<template>sms_bin</template><WapID>aaaaa</WapID><pnummer>1</pnummer>")

For more information    For more information on the built-in properties, see Built-in properties.

 
Top of page

Working with XML templates

The template for an XML log file specifies one or more XML elements, as well as variables that will be replaced with log data. For example, the format for an XML file might be:

  <?xml version="1.0"?>
  <root>${event}</root>

When a new log file is created, the template is used to format the file. The ${} variable is replaced with the actual log strings. The value specified within the braces is also added as an enclosing element. For example:

  <?xml version="1.0"?>
  <root><event>logString2</event>
  <event>logString2</event>
  </root>

 
Top of page

Working with IPDR templates

The template for an IPDR log file contains a set of standard IPDR elements. In addition, it may contain variables that will be replaced with log data. For example:

  <IPDRDoc seqNum="6530" version="1.0">
   <IPDRRec info="Novell"/>
   <IPDR seqNum="${Sequence}" time="${Time}">
    <SS id="sms" service="bin">
     <SC>
      <v name="customer_id">${WapID}</v>
     </SC>
     <SE>
      <v name="service">sms-bin</v>
     </SE>
    </SS>
    <UE>
     <v name="pnummer">${pnummer}</v>
    </UE>
   </IPDR>
  </IPDRDoc>

 
Top of page

Built-in properties

The following built-in properties have been added to support XML and IPDR logging. Each of these properties can be set in the config.xml file for the Framework subsystem, or by calling a method on the EboLog class:

Property

Description

Value

EboLog method

logFileTemplate

The log file template to be used

The name of a template placed in the conf directory for the Framework

Default value: xml-file.tpl

setLogFileTemplate (String logFileTemplate)

addLogDateInfo

Indicates whether a log Date should be added to the log string

true/false

Default value: true

setAddLogDateInfo (String addLogDateInfo)

logDateFormatMask

The mask to use for the log Date information

java.text.SimpleDateFormat mask

Default value: dd/MM/yy HH:mm:ss

setLogDateFormatMask (String logDateFormatMask)

addLogTimeInfo

Indicates whether a log Time should be added to the log string

true/false

Default value: true

setAddLogTimeInfo (String addLogTimeInfo)

logDateFormatMask

Indicates whether a log Time should be added to the log string

java.text.SimpleDateFormat mask

Default value: yyyy-MM-dd'T'HH:mm:ss'Z'

setLogTimeFormatMask (String logDateFormatMask)

addLogSequenceInfo

Indicates whether a unique Sequence should be added to the log string

true/false

Default value: true

setAddLogSequenceInfo (String addLogSequenceInfo

 
Top of page

Sample code

Here is sample code for using XML and IPDR logging:

  // XML logging sample: 
  private com.sssw.fw.log.EboLog log;
  
  log = (EboLog) EboLogFactory.getLog( "XML Test" ); log.addLoggingProvider(EboUniqueXMLFileLoggingProvider.class.getName()); log.audit("xml_file This is my event"); 
  log.removeLoggingProvider(EboUniqueXMLFileLoggingProvider.class.getName()); log2 =
    (EboLog) EboLogFactory.getLog( "IPDR Test" ); 
  
  // IPDRF logging sample ...
  private com.sssw.fw.log.EboLog log2;
  
  log2.addLoggingProvider(EboUniqueIPDRFileLoggingProvider.class.getName()); log2.audit("sms_bin555123455"); log2.removeLoggingProvider(EboUniqueIPDRFileLoggingProvider.class.getName()); 
  


Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.  more ...