WebSphere Application Server Network Deployment, Version 6.0.x     Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

Best Practices for Logging Common Base Events in WebSphere Application Server

The following practices will ensure consistent use of Common Base Events within your components and between your components and WebSphere Application Server components:
  • Use a different Logger for each component. Sharing loggers across components gets in the way of being able to associate Loggers with component specific information
  • Associate Loggers with event templates that specify source component identification. This ensures that the source of all events created with the Logger is properly identified.
  • Use the same template for directly created Common Base Events (events created using the Common Base Event factories) and indirectly created Common Base Events (events created using the Java logging API) within the same component.
  • Avoid calling the complete method on CommonBaseEvents until you are finished adding data to the CommonBaseEvent and are ready to log it. This ensures that any decisions made by the ContentHandler based on data already in the event will be made using the final data.
The following sample logger.properties file entry demonstrates how to associate Logger com.ibm.componentX with event factory com.ibm.componentX:
com.ibm.componentX.eventfactory=com.ibm.componentX
The following sample code demonstrates the use of the same event factory setting for direct (Part 1) and indirect (Part 2) Common Base Event logging:
<?xml version="1.0" encoding="UTF-8"?>

<TemplateEvent 
		version="1.0.1" 
		xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
		xsi:noNamespaceSchemaLocation="templateEvent.xsd">

	<CommonBaseEvent 
		 <sourceComponentId application="My application" component="com.ibm.componentX"/>
		 <extendedDataElements CommonBaseEventname="Sample ExtendedDataElement name"	type="string">
		 <values>Sample ExtendedDataElement value</values>
		</extendedDataElements>
	< /CommonBaseEvent>

< /TemplateEvent>
Reference topic    

Terms of Use | Feedback

Last updated: Mar 17, 2005 4:28:29 AM CST
http://publib.boulder.ibm.com/infocenter/ws60help/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rtrb_cbebestpract.html

© Copyright IBM Corporation 2004, 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)