Example: Monitoring events in the logger

Why and when to perform this task

You will use the business rules sample application for this scenario, so you should already have the web page containing this application already open. Keep it open, since you will be running the sample after you specify monitoring parameters. Ensure that you have already run the sample at least once, so that it will appear in the list of functions that you can select to monitor.

Steps for this task

  1. Open the administrative console.
  2. In the navigation pane, click Servers > Application Servers.
  3. Click server_name.
  4. Under Troubleshooting, click Logging and tracing
  5. Click Change Log Detail levels
  6. Select the Runtime tab.
  7. Expand the tree for WBILocationMonitor.LOG.BR and you will see seven event types under the WBILocationMonitor.LOG.BR.brsample.* element:
    • WBILocationMonitor.LOG.BR.brsample_module.DiscountRuleGroup
    • WBILocationMonitor.LOG.BR.brsample_module.DiscountRuleGroup.Operation._calculateDiscount
    • WBILocationMonitor.LOG.BR.brsample_module.DiscountRuleGroup.Operation._calculateDiscount.ENTRY
    • WBILocationMonitor.LOG.BR.brsample_module.DiscountRuleGroup.Operation._calculateDiscount.EXIT
    • WBILocationMonitor.LOG.BR.brsample_module.DiscountRuleGroup.Operation._calculateDiscount.FAILURE
    • WBILocationMonitor.LOG.BR.brsample_module.DiscountRuleGroup.Operation._calculateDiscount.SelectionKeyExtracted
    • WBILocationMonitor.LOG.BR.brsample_module.DiscountRuleGroup.Operation._calculateDiscount.TargetFound
  8. Click on each of the events and select finest.
  9. Click OK.
  10. Switch the business rules sample application page, and run the application once.
  11. Use a text editor to open the trace.log file located in the install_root/profiles/profile_name/logs/server_name folder on your system.

Result

You should see lines in the log containing the business rule events fired by the monitor when you ran the sample application. The main thing you will probably notice is that the output consists of lengthy, unparsed XML strings conforming to the Common Base Event standard. Examine the ENTRY and EXIT events, and you will see that business object — which was included because you selected the finest level of detail — is encoded in hexadecimal format. Compare this output with events published to the Common Event Infrastructure server, which parses the XML into a readable table and decodes any business object data into a readable format. You may wish to go back through this exercise and change the level of detail from finest to fine or finer, and compare the differences between the events.

After completing this exercise, you should understand how to select service component event points for monitoring to the logger. You have seen that the events fired in this type monitoring have a standard format, and that the results are published as a string in raw XML format directly to a log file. Viewing the published events is simply a matter of opening the log file in a text editor, and deciphering the contents of individual events.

What to do next

If you no longer want to monitor the business rules sample application, you can go back to through the steps outlined here and reset the level of detail for the sample events to info.

(c) Copyright IBM Corporation 2005, 2006.
This information center is powered by Eclipse technology (http://www.eclipse.org)