Using APEX_DEBUG to Diagnose Oracle APEX Issues

Search for a command to run...

No comments yet. Be the first to comment.
Oracle APEX already includes Font APEX as the default icon library for Universal Theme. In most cases, that is enough. But in one of my APEX apps, I needed a few icons that were not available there, s

Looking to give your Oracle APEX mobile app a modern, native feel? Here’s a quick hack: add a floating action button that stays anchored at the bottom corner just like in popular mobile apps. This sma

APEX 26.1 has been updated to the Universal Theme. While much of the attention in this release is on AI features, I think the UT improvements are just as important for developers like me who care abou

The apex_barcode package offers a PL/SQL API to generate various types of barcodes. You can output barcodes as SVG (Scalable Vector Graphics) values or as PNG file blobs, making it easy to embed them

Oracle APEX makes it easy to get data on screen fast, but often, the default tabular output isn’t enough. What if you want to highlight statuses, add icons, or display badges all without writing compl

Oracle APEX offers robust debugging tools that help devs identify issues, optimize performance, and ensure smooth user experiences. The apex_debug package is central to this, providing detailed insight into your app’s behavior at runtime. Here’s a practical guide to using apex_debug and related features for debugging and tuning your APEX apps.
How to enable APEX_DEBUG?
There are several ways to enable debug mode in APEX:
Developer toolbar: Click the "debug" button in the developer toolbar while running your application.
URL parameter: Append &p_debug=YES or &p_debug=LEVEL (where level is 1–9) to your application URL for different verbosity levels.
Application property: Set the application’s debug property to "yes" for persistent debug logging.
APEX_DEBUG API: Use apex_debug.enable in PL/SQL to programmatically enable debugging for a session.
apex_debug.info('My Debug message, showing order_id: %s', p_order_id);
apex_debug.warn('unexpected status: %s', p_status);
apex_debug.error('Warning, my debug error: %s', sqlerrm);
| Procedure | Purpose & Level | When to Use |
|---|---|---|
apex_debug.error |
Level 1 (Critical error) | For logging critical errors or failures that require immediate attention or may halt processing. |
apex_debug.warn |
Level 2 (Warning) | For logging important, non-critical issues that should be reviewed but do not stop processing. |
apex_debug.info |
Level 4 (Informational, default level) | For routine information, such as variable values, process steps, or general progress messages. |
apex_debug.trace |
Level 6 (Trace) | For detailed, low-level tracing of code execution, such as inside loops or complex logic blocks. |
To view the debug messages, click on "View Debug" in the dev toolbar, or go to Utilities / Debug Messages, or also running the following query:
select *
from apex_debug_messages
Be careful when logging too many messages, for example, inside a loop. Be aware of APEX flood control, which limits the number of debug messages per page view (the default is 50,000).
You can check this limit with the query below (run as sys).
select *
from APEX_INSTANCE_PARAMETERS
where name = 'DEBUG_MESSAGE_PAGE_VIEW_LIMIT';
You can use apex_debug in standalone PL/SQL scripts or jobs:
apex_session.create_session(p_app_id=>101, p_page_id=>1, p_username=>'RODRIGO');
apex_debug.enable(apex_debug.c_log_level_info);
apex_debug.info('My debug message from sql developer');
apex_session.detach;
The APEX debug feature is very powerful and useful. To help you troubleshoot issues, enable debug mode and use the browser’s developer tools to inspect AJAX calls and dynamic actions. The debug log will display the sequence and timing of events, helping you identify problems with client-side interactivity.