Logging in Oracle BPEL at times becomes necessary even though we got a powerful and user-friendly Enterprise Manager(EM) console which acts as a debugging tool where you can trace and track BPEL process instances. Such as, in BPEL process instance flow that got executed you may have many sequential activities with multiple loop statements within, it will be difficult to determine what has happened in the execution of such instances from the long list of activities showing up on EM console.
Logging in BPEL can be realised using Oracle BPEL Variable Sensors. Sensors in BPEL are of three different types; variable sensors are used for logging which can be triggered when value in the process variable gets changed. In order to get this implemented, you need to create a process variable, define sensor variable from the process variable, and then define and map the action that needs to be done when the sensor is triggered. Note that the variable sensor is triggered each time when the value contained in the variable gets changed.
1. Create a Process variable
Define a process variable from Create Variable screen of BPEL , define the variable of string data type.
In monitor view of the BPEL component file in JDeveloper, click on the Monitoring Objects option to select the Sensors option.
Select the Variable Sensor option from the Sensors window. Name the sensor and chose the target as process variable created in step 1.
3. Define Sensor Action
Click on the Sensor Action option from the drop down menu of Monitoring Objects in the Monitor View of BPEL Component in JDeveloper.
Create a Sensor Action with Publish Type as Database.
4. Map the Sensor Action to Sensor Variable
Edit the Sensor Variable created in step 2 to map it to the sensor action of step 3 from the Edit Variable Sensor window of Sensor Variable.
Now that you have configured BPEL variable sensors, any change in the value of BPEL sensor variable will be shown in the Sensor Values tab of the BPEL flow instance of EM console.
Thus, you can use variable sensors to populate with meaningful data at various places in the BPEL program to capture the process instance flow at run time.