IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Access external services with adapters > Configure and using adapters > IBM WebSphere Adapters > Adapter Toolkit > Implementing code from the IBM WebSphere Adapter Toolkit > Problem determination > Monitoring and measuring performance > Common Event Infrastructure

Extend Common Event Infrastructure logging on IBM BPM

You can extend CEI logging to WebSphere Process Server by adding custom events.


Example of how to log an event

The following example describes how to log an event named Polling, when the event action is Started and you want to log two integers values for this event in the CEI database.

  1. Monitorable Element Schema “.mes” file changes

    Defines element types that you want to monitor (Polling for example) and it also defines natures that are available for each element type (STARTED).

    <?xml version="1.0" encoding="UTF-8"?>
    <EventNaturesSpec name="EventNatures" targetNamespace=
    "http://www.ibm.com/xmlns/prod/websphere/scdl/eis/6.0.0:JCAAdapter"
    	xmlns=
    	"http://www.ibm.com/xmlns/prod/websphere/monitoring/6.1/mes"
    	xmlns:eis=
    	"http://www.ibm.com/xmlns/prod/websphere/scdl/eis/6.0.0:JCAAdapter" 
     shortName="ResourceAdapter">
    
    <Property>CEI</Property>
    <ElementKind name="Polling">
    	<EventNature name="STARTED" eventName
    	="eis:WBI.JCAAdapter.Polling.STARTED" />
    </ElementKind>
    </EventNaturesSpec>
  2. “.xsd” file changes

    The .xsd event schema file provides monitoring that is specific to each data element, and it also defines the types of events that can be emitted for the data elements. The following is an example of xsd event schema content::

    <?xml version="1.0" encoding="UTF-8"?>"
    <EventSpec xmlns=
    "http://www.ibm.com/xmlns/prod/websphere/monitoring/6.0.0/es"
    	name="Events"
        targetNamespace=
    	"http://www.ibm.com/xmlns/prod/websphere/scdl/eis/6.0.0:JCAAdapter"
    	xmlns:er=
    	"http://www.ibm.com/xmlns/prod/websphere/recovery/6.0.0/es/eventpayloads"
    >
    <Event name=
    	"ResourceAdapter.Polling.STARTED" situationType=
    "STATUS" situationCategory="ReportSituation" 
    reasoningScope=
    "EXTERNAL" parent="WBI.MonitoringEvent">  
    	<Payload>
    		<Data name=
    		"PollFrequency" type="int" minOccurs="0" maxOccurs="1"/>
    		<Data name=
    		"PollQuantity" type="int" minOccurs="0" maxOccurs="1"/>
    	</Payload>
    </Event>

  3. Invoke Events

    import com.ibm.j2ca.extension.logging.internal.cbe.EngineData;
      ...
    CBEEngineData engineData = 
    CBEEngineDataFactory.getEngineDataForEventType("Polling");
    //This will instantiate the EngineData class for user 
    	defined event e.g "Polling".
    engineData.setValue("EventAction","STARTED");
    //This will set the user defined action e.g. "Started"
    engineData.setValue("PollFrequency", 
    activationSpec.getPollPeriod());
    //This will set the user defined arg
    engineData.setValue("PollQuantity", 
    activationSpec.getPollQuantity());
    //This will set the user defined arg
    

Common Event Infrastructure (CEI)