beautypg.com

Logging and tracing messages – IBM WebSphere Adapters User Manual

Page 180

background image

You can use the FaultBOUtil to define the fault business object, as long as either
no attributes or only simple attributes are added. This should amount to a few
lines of code, See Implementing Faults for an example.

Note:

The model for fault classes and fault business objects is a 1-to-1

relationship, the base fault business object cannot be used even if no additional
attributes are needed. This is because SCA does not pass back the fault name to
the client / server runtime. Instead, the fault name is resolved to the fault (BO)
type. So if you reuse fault BOs, you cannot definitively determine which fault
occurred.

Logging and tracing messages

Providing information about the runtime state of the adapter is a critical aspect of
adapter development. The Adapter Foundation Classes include the LogUtils class.
When implemented, this functionality enables developers to target information to a
variety of user roles, enabling them to filter information by levels of importance
and to generate informational events that can be monitored by and acted upon by
WebSphere Process Server.

Information about the runtime state of the adapter is invaluable not only to
support teams trying to resolve problems but also to users looking to monitor the
adapter and track its operations. For these reasons, you should focus early in your
adapter development process on what information to provide, which users to
target, and how to most efficiently and clearly communicate the information.

The JCA 1.5 specification provides minimal support for communicating
information to users. It defines a single stream to which the adapter writes any
and all information. As a result, without additional tools or support, users cannot
filter information, analyze information or, in general, easily determine what
information is of interest to them.

The New Adapter wizard generates code skeleton using Adapter Foundation
Classes to provide you with a consistent method to get the LogUtils object in your
own implementation. This is very useful when an adapter wants to record business
information or needs to track execution flow. The LogUtils class allows you to
direct information usefully to a variety of users by generating three types of

″messages″: trace, log, and event messages. Each has a distinct purpose and
conveys different information.

v

The following guidelines apply to trace messages:
– They do not contain information needed by general users to resolve problems
– They encapsulate information intended for support and other development

teams

– They need not be translated
– They can be hard-coded in the adapter itself
– They feature three levels of detail: fine, finer, and finest

v

The following guidelines apply to log messages:
– They encapsulate information such as warnings and errors that are targeted at

general users of the adapter

– Rather than hard-code log messages in the adapter, place them in a separate

log message file to facilitate translation into localized languages

– They feature multiple levels that users can employ to filter log messages

v

The following guidelines apply to event messages:

174

WebSphere Adapters: WebSphere Adapter Toolkit User Guide