Viewing Activity Logs by using a custom integration application

View Activity Log entries for message flows and resource types by using custom integration applications.

Before you begin

About this task

You can create custom integration applications to examine and analyze your Activity Logs.
Checking which resource types can generate Activity Logs
/*
 * Sample IBM Integration API code that connects to a local integration node
 * called 'testbrk' and lists the available
 * resource types on the integration server 'exgp' that can 
 *  generate Activity Logs.
 */
try {
  BrokerProxy b = BrokerProxy.getLocalInstance("testbrk");
  if (b != null) {
    ExecutionGroupProxy e = b.getExecutionGroupByName("exgp");
    if (e != null) {
      Properties rms = new Properties();
      rms.setProperty(AttributeConstants.ACTIVITYLOG_SUPPORTED_PROPERTY, AttributeConstants.TRUE);
      Enumeration <ResourceManagerProxy> rmps = e.getResourceManagers(rms);
      while (rmps.hasMoreElements()) {
        ResourceManagerProxy rmp = rmps.nextElement();
        String name = rmp.getName();
        System.out.println(name);
      }
    }
  }
} catch (ConfigManagerProxyException ex) {
    ex.printStackTrace();
}
Retrieving Activity Log entries for a particular resource type
/*
 * Sample IBM Integration API code that connects to a local integration node
 * called 'testbrk' and retrieves and prints out Activity Log
 * entries for resource type 'JMS' on integration server 'exgp'.
 */
try {
  BrokerProxy b = BrokerProxy.getLocalInstance("testbrk");
  if (b != null) {
    ExecutionGroupProxy = b.getExecutionGroupByName("exgp");
    if (e != null) {
      ResourceManagerProxy rmp = e.getResourceManagerByName("JMS");
      if(rmp != null) {
        ActivityLogProxy al = rmp.getActivityLog();
        if (al != null) {
          for (int i = 1; i <= al.getSize(); i++) {
            ActivityLogEntry ale = al.getLogEntry(i);
            System.out.println(ale);
            System.out.println(ale.getMessageNumber());
          }
        }
      }
    }
  }
} catch (ConfigManagerProxyException ex) {
    ex.printStackTrace();
}
Retrieving Activity Log entries for a particular message flow
/*	
 * Sample IBM Integration API code that connects to a local integration node
 * called 'testbrk' and gets references to the execution
 * group called 'default', the application belonging to this integration server called 'app', 
 * and the message flow in the application called 'msgflow'. 
 * It prints out the Activity Log entries for message flow 'msgflow'.
 */
try {
  BrokerProxy b = BrokerProxy.getLocalInstance("testbrk");
  if(b != null) {
    ExecutionGroupProxy e = b.getExecutionGroupByName("default");
    if (e != null) {
      ApplicationProxy ap = e.getApplicationByName("app");
      if (ap != null) {
        MessageFlowProxy mf = ap.getMessageFlowByName("msgflow");
        if(mf != null) {
          ActivityLogProxy al = mf.getActivityLog();
          if (al != null) {
            for (int i = 1; i <= al.getSize(); i++) {
              ActivityLogEntry ale = al.getLogEntry(i);
              System.out.println(ale);
              System.out.println(ale.getMessageNumber());
            }
          }
        }
      }
    }
  }
} catch (ConfigManagerProxyException ex) {
	ex.printStackTrace();
}