BP Fault XML Log adapter

The BP Fault XML Log adapter provides a custom log to a business process that can read a created log for formatting or processing.

The following table provides an overview of the BP Fault XML Log adapter:

System name BPFaultLogXML
Graphical Process Modeler (GPM) category All Services
Description Enables a business process writer to log business-specific messages to a file in XML format. Each log item is an XML document fragment.
Business usage Use this service to provide a custom log to a business process. This can also be used to read a created log for formatting or processing.
Usage example You have written a large BPML to process widgets, and would like to provide feedback to a log to track the processing or any faults that occur. The XML generated can be read for formatting. A typical read example would be a read and format into HTML using XSLT.
Preconfigured? No
Requires third-party files? None
Platform availability All supported platforms
Related services None
Application requirements Designate a location on disk to send and view logs.
Initiates business processes? No
Invocation Must be a step in the business process or in the on-fault handler.
Business process context considerations For WRITE operations: When set to fail on error, the business process context status will be set to ERROR.
Returned status values
Returned status values:
  • Success
  • Error
Note: For WRITE operations, this adapter will always return a status of “Success” because it is typically a non-critical part of a business process. If a failure occurs it is logged, but the business process continues.
Restrictions None
Persistence level Default
Testing considerations None

Implementing the BP Fault XML Log adapter

To implement the BP Fault XML Log adapter, complete the following tasks:
  1. Create a BP Fault XML Log adapter configuration.
  2. Configure the BP Fault XML Log adapter.
  3. Use the BP Fault XML Log adapter in a business process.

Configuring the BP Fault XML Log adapter

To configure the BP Fault XML Log adapter, you must specify field settings in the GPM:

Field Description
Config Name of the service configuration.
action Valid values are:
  • READ–Reads the specified log from the specified directory, and uses the loggerName value as a prefix of the log file to read and loggerPath value as the directory path of where the log files are located.
  • WRITE–performs a normal log write operation.
combineLog Valid values are:
  • True – Logs will be combined. When more than one log file name matches the prefix specified by the loggerName value, these log files will be combined into well-formed XML and placed onto process data as a single document. The process data document name is the specified loggerName value.
  • False – Logs are not combined. When more than one log file name matches the prefix specified by the loggerName value, each log file will be placed onto process data. The process data document names are the same as the original log file names.
fail-on-error Whether to cause the business process to fail if an error is logged. Optional. Valid values are True and False. Used for WRITE operations only. If this parameter is set to True, and the log-level parameter is set to ERROR, the business process status is set to Error and the business process advanced status is set to the value in the log-message. This enables you to force a business process to fail (based on invalid business process data), when it may have ordinarily succeeded.
includeBody Whether to include the body of the data with the error message. Required. Used for WRITE operations only. When the body is included, only the first 2048 bytes are included. Valid values are:
  • True – Include the error message and the body of the data.
  • False – Include the error message only.
log-level Type of log. Required. Used for WRITE operations only. Values are:
  • DEBUG – An error message for internal use
  • ERROR – A general error in the business process
  • INFO – Who the error message was sent to
  • WARN – A significant error in the business process
Note: You can add custom log levels to this list in the GPM, or by editing a business process in the business process editor.
log-message Message that you want to send to the log. Required. Used for WRITE operations only.
loggerName Name of the log. Required. The file created in the Logger Output Path is given this name and an extension of .log. Used for both READ and WRITE operations.
loggerPath Path used to write the log to a file. Required. Used for both READ and WRITE operations. Valid value is a valid full path.
logType Select type of log. Required. Used for WRITE operations only. Valid values are Normal and Rolling.
maxLogSize Maximum log size for rolling in bytes. Required if you selected Rolling as the log type in the service configuration. Used for WRITE operations only. Valid value is a number greater than zero.

Business Process Example

The following example shows how the BP Fault XML Log adapter could be used in a business process:

<process name="default">
  <operation name="BPFaultLogXML">
    <participant name="mybpfaultxmllog"/>
    <output message="BPFaultLogXMLInputMessage">
      <assign to="action">WRITE</assign>
      <assign to="combineLog">false</assign>
      <assign to="fail-on-error">true</assign>
      <assign to="includeBody">true</assign>
      <assign to="log-level">DEBUG</assign>
      <assign to="log-message">hello log</assign>
      <assign to="loggerName">testlog.log</assign>
      <assign to="loggerPath">/home/user/</assign>
      <assign to="logType">normal</assign>
      <assign to="." from="*"></assign>
    </output>
    <input message="inmsg">
      <assign to="." from="*"></assign>
    </input>
  </operation> 
</process>