Scenario: I'm working on an APEX application and I want to debug some functionality between several pages. I'm in the APEX development environment so I click the "Debug" link in the developer toolbar. I perform some action (click a button or link in a report) that results in a redirect to another page, but alas, the page I'm now on isn't collecting any debug information.
Cause: Most times this is caused by a missing debug option in a hard-coded APEX URL which can be found in a column link, button URL, list entry URL, or page branch. For example, the link could be defined like "f?p=&APP_ID.:&PAGE_ID.:&APP_SESSION.". To ensure the debug option is enabled it could be defined as "f?p=&APP_ID.:&PAGE_ID.:&APP_SESSION.::&DEBUG.". One could, or should, go through all the links and correct them, or....
Resolution: APEX debugging can be turned on by using the APEX_DEBUG.ENABLE procedure call. To have this called at an early point during the page request add it to the "Initialization PL/SQL Code" located in Database Session section of the page definition Security tab. ( Shared Components->Security Attributes )
Don't forget to remove this when you are done debugging as it will have performance implications. I've embedded the call inside an IF clause so it will stop being executed after the date I hard coded into the comparison (just in case I get distracted and forget to remove it).
When comparing the debug entries for a page where the debug flag is set in the URL vs. this method we notice that there a quite a few entries missing.
Enabling the APEX debugging in the Initialization PL/SQL Code will start the debugging just before the "Before Header" point of page rendering, bypassing the NLS settings and session management points of the page rendering process which is logged by the normal debug functionality.