25.4.3.1 Querying Recent Debug Messages

Query recent debug messages to find workflow errors and related trace details.

The APEX engine logs unexpected errors. Query them using the APEX_DEBUG_MESSAGES view. Run the query below in the SQL Workshop > SQL Commands window to see the most recent debug messages in your workspace. These may include messages related to business process logic, or messages from page processing.

select apex_util.get_since(message_timestamp) as when, message 
  from apex_debug_messages
 order by message_timestamp desc

A more detailed query against this view to see only workflow related messages is the following. Notice it also includes the WORKFLOW_INSTANCE_ID that encountered the problem:

select message_timestamp,
       elapsed_time,
       execution_time,
       message,
       page_id,
       workflow_instance_id,
       session_id,
       message_level,
       trim(replace(call_stack,'%')) as call_stack
 from apex_debug_messages
where application_id = :APP_ID
and apex_user = 'nobody'
and call_stack like '%\%WORKFLOW.%' escape '\'
and message_level < 9
order by message_timestamp desc