7 Enabling ECID in Coherence Logs

Oracle Coherence can use an Execution Context ID (ECID). This globally unique ID can be attached to requests between Oracle components. The ECID allows you to track log messages pertaining to the same request when multiple requests are processed in parallel.

Coherence logs will include ECID only if the client already has an activated ECID prior to calling Coherence operations. The ECID may be passed from another component or obtained in the client code. To activate the context, use the get and activate methods on the oracle.dms.context.ExecutionContext interface in the Coherence client code. The ECID will be attached to the executing thread. Use the deactivate method to release the context, for example:

Example 7-1 Using a DMS Context in Coherence Client Code

...
// Get the context associated with this thread
ExecutionContext ctx = ExecutionContext.get();
ctx.activate();
...
set additional execution context values (optional)
perform some cache operations
... 
// Release the context
ctx.deactivate();
...

ECID logging will occur only on the node where the client is running. If a client request is processed on some other node and an exception is thrown by Coherence, then the remote error will be returned to the originating node and it will be logged on the Coherence client. The log message will contain the ECID of the request. Messages logged on the remote node will not contain the ECID.

To include the ECID in a Coherence log message, see Changing the Log Message Format in Developing Applications with Oracle Coherence.