Using the BPEL Designer and Service Engine

BPEL Process Logging and Alerting

The Sun BPEL Service Engine provides you with the ability to trace the message or expression values during the process execution. The Logging and Alerting feature make use of standart WS-BPEL extension mechanism. Logging and alerting are supported for almost all BPEL activities.

The NetBeans IDE provides the ability to define logging and alerting for the process activities.

After you set the logging or alerting conditions and the BPEL process is executed, specified expression values are written to the server log file or an alert is sent to the user, depending on the log level.

Both logging and alerting are defined in the Logging mapper. The Logging mapper is available from the Design or Source view menu bar.

Defining Logging

When defining logging for an activity you can trace the value of the following components :

In the mappings you can use one or more XPath functions from the menu bar.

ProcedureTo log the variable value:

  1. On the diagram, select an activity. The logging will be performed in connection with the activity execution.

  2. Go to the Logging tab of the BPEL Editor. The Logging mapper opens. You can also open the Logging mapper by right clicking the activity and choosing Go To -> Logging (Alt-L).

  3. In the source tree pane, expand the variables tree until the variable to be traced is visible.

  4. In the destination tree pane expand the activity node. The nodes designating the moment of logging become visible.

  5. Choose when the logging entry should be made and expand the appropriate node:

    • LOG_onStart. The variable value is written to the log when the activity starts.

    • LOG_onComplete. The variable value is written to the log when the activity execution is complete.

  6. Define the level of logging. Drag the connection from the variable to be traced to the appropriate node in the destination tree pane. The following levels of logging are available:

    • Severe

    • Warning

    • Info

    • Config

    • Fine

    • Finer

    To make a search of the value recorded to the log file, you can concatenate the value with the string literal as shown on the figure below.

    Image shows the Logging mapper as described in contex

    In the Design view a small icon appears to the lower-right of the activity when it has logging defined. By clicking the icon you can switch to the Logging mapper.

    Image shows the Logging icon next to the Assign element
in the BPEL Mapper

    The entry to the log is only made if the log level defined for the variable corresponds to the log level specified for the BPEL Service Engine on the application server.

ProcedureTo set the log level for the BPEL Service Engine

The log level for the BPEL Service Engine is specified in the GlassFish Admin Console. To set the log level for the BPEL Service Engine:

  1. In the NetBeans Services window, expand the Servers node and ensure that the GlassFish application server is running. A green arrow badge next to the server node indicates that the server is running. If the server is not running, right click the server name and choose Start from the context menu.

  2. Open the Admin Console in your browser. To do this, follow the steps:

    • Right click GlassFish V2 application server node, and choose Properties from the context menu. The Servers window opens. On the Servers pane, GlassFish V2 should be selected.

    • On the Connection tab, copy the contents of the Location field (by default it is localhost:4848).

    • Paste the string to the browser and press Enter. The GlassFish Admin Console opens in the browser window.

  3. Log in to the Admin Console using your username and password. By default, the username is admin and the password is adminadmin.

  4. On the left pane under the JBI node choose Components -> sun-bpel-engine. The BPEL service engine properties page opens.

  5. On the BPEL service engine properties page, select the Loggers tab. On the Loggers tab you can specify log levels for the individual loggers.

  6. Choose the appropriate log level for the sun-bpel-engine from the drop down list.

    If logging is defined for a process activity, and the log level specified for it corresponds to the log level set for the BPEL SE, after you perform a test run of the process, the selected variable value will be written to the server log file.


    Note –

    The project should be deployed to the application server.


ProcedureTo view the log file:

  1. In the Services window, under the Servers node, right click GlassFish V2 application server node and choose View Server log from the context menu. TheGlassFish server log opens in the Output window. The activity message value will be included in the log, you can use Search to find it. Note, that some overhead information is hidden.

  2. You can also open the log in a text editor and see the full information. Navigate to <application server installation directory>/domains/domain1/log/ and open the server.log file with the text editor. The information provided in the log includes the following points, divided with the vertical bar:

    • Date and time of the entry

    • Log level

    • Manager type (for logging this is Trace Manager)

    • Thread

    • The message value

      Here is the sample of the log entry :

      [#|2008-03-25T09:26:18.796+0300|INFO|sun-appserver9.1|com.sun.jbi.engine.bpel.core.bpel.trace.BPELTraceManager|_ThreadID=26;_ThreadName=BPELSEInOutThread8;|<?xml version="1.0" encoding="UTF-8"?><jbi:message xmlns:msgns="http://localhost/SynchronousSample/SynchronousSample" name="input1" type="msgns:requestMessage" version="1.0" xmlns:jbi="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper"><jbi:part><syn:typeA xmlns:syn="http://xml.netbeans.org/schema/SynchronousSample"> <syn:paramA>Hello World</syn:paramA> </syn:typeA></jbi:part></jbi:message>|#]

Defining Alerting

Alerting feature enables you to get notification in case specified events happen. Alerting events are connected with the execution of the process activities.

As a general rule-of-thumb, whenever you log you may also want to consider sending an alert notification of the appropriate severity as you see fit. Fatal, Critical, and Major Alert Notification Severities map well to a SEVERE logging category. The Minor and Warning Alert Notification Severities map well to a WARNING logging category. The Info Alert Notification Severity maps well to an INFO logging category.

The general workflow for defining alerting is as follows:

  1. Set the alert level for your activity. This is done from the Logging Mapper, similar to the way you define Logging. Map the variable in the Output pane for which you want an alert, to the appropriate Alert activity and alert level, for example, ALERT_onComplete - major.

    The Alert notification levels are:

    • Fatal

    • Critical

    • Major

    • Minor

    • Warning

  2. Ensure the application server is running and deploy the project.

  3. From the Admin Console, choose or create MBean client and subscribe to getting event notifications. The client will extract alerting messages and perforn specified actions (write to log/send e-mail/do nothing).

  4. Run the process and get notified.