Logging exceptions
This recipe explains how to log exceptions from the BPEL process to the logfiles. We will examine how to log exceptions from the Java Embedding activity and how to log faults to the logfiles.
Getting ready…
To complete this recipe, we need to create an empty composite. Also, we need an empty synchronous BPEL 2.0 process.
To log the exceptions, we will extend the logger we defined in the Creating a custom logger in a BPEL process recipe of Chapter 3, Advanced Tracing and Logging. In this recipe, we will also reuse the logging configuration created in that recipe. We extend the LogTheBpelExt
class by adding an additional method called logException
as shown in the following code:
public static final void logException(String msg, Exception e) { logger.logp(Level.SEVERE, "", "", msg, e); }
This method enables the logging of exceptions on BPEL processes.
How to do it…
To handle exceptions occurring from code execution in a Java Embedding activity, perform the following steps:
Open...