IBM BPM, V8.0.1, All platforms > Measuring and improving business processes > Monitoring > Enabling and configuring service component monitoring > Monitoring service component events > Configure logging for service component events > Tutorial: Logging service component events
Example: Monitoring events in the logger
For monitoring with logging, you can use the administrative console to manage the details for event types. This example shows the use of the console to change the level of detail recorded for some event types and to use a text editor to open the trace.log file to view the information for individual events.
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.
Procedure
- Open the administrative console.
- In the navigation pane, click Servers > Application Servers.
- Click server_name.
- Under Troubleshooting, click Logging and tracing
- Click Change Log Detail levels
- Select the Runtime tab.
- 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
- Click each of the events and select finest.
- Click OK.
- Switch the business rules sample application page, and run the application once.
- Use a text editor to open the trace.log file located in the profile_root/logs/ server_name folder on your system.
Results
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 want 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. To view the published events, open the log file in a text editor, and decipher 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.
Tutorial: Logging service component events