6 Replies Latest reply: Sep 6, 2013 10:11 AM by SATim RSS

    Runtime Debugging - How to?

    SATim

      I built a new page in dev environment.

      It has a select list and an Add button to add selected items from list.  It works exactly as planned.

       

      Moved it to the QA environment and it does not work.  I have checked grants, same in both environments.  packages - same.  tables - same. types - same

      But I get the process error message in QA.

       

      How can I debug in a runtime environment so I can get some clues why it is not working?

       

      <code>

      INSERT INTO MDM_DATA.REF_CMR(STORE_CD)

      (SELECT * FROM TABLE(MDM_DATA.UTIL.SPLIT(:P401_STORE_LIST,':')));

      COMMIT;

       

      UPDATE MDM_DATA.REF_CMR

      SET CMR_MARKET = NVL(:P400_CURRENT_MKT,:P400_NEW_MKT_NAME)

      WHERE UPPER(CMR_MARKET) = 'UNASSIGNED';

       

      UPDATE MDM_DATA.REF_CMR RC

      SET RC.CITY_NM = (SELECT CITY_NM FROM MDM_DATA.MD_STORE S WHERE S.STORE_CD = RC.STORE_CD)

      WHERE RC.CITY_NM IS NULL;

      COMMIT;

      <code>

        • 1. Re: Runtime Debugging - How to?
          swesley_perth

          Check out the "Debugging an application" part of the APEX builders manual

          http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35125/debug.htm#BCGCIBJA

           

          Then starting adding some apex_debug.message() calls

          APEX_DEBUG

           

          That would probably be the best way forward.

          • 2. Re: Runtime Debugging - How to?
            SATim

            Thanks Scott.  I use those tools extensively in the dev environment but they are unavailable in the runtime environment.  In the APEX Installation guide it refers to Managing a Runtime Environment in the Application Builder User's Guide (like you said) but a search there returns nothing.  I looked in the Administration Guide and found how to export the workspace from dev to runtime, then import the application.  There is no mention if the debug tools are then available of if that changes the runtime to a dev environment. 

             

            APEX DEBUG

            MESSAGE is passing in a string and LOG_PAGE_SESSION_STATE seems useful but there is no indication on how to use them in the application

             

            Where would I add calls within the application?   in the page process? 

             

            <code>

            BEGIN

              APEX_DEBUG.ENABLE (p_level => 2);

              

              APEX_DEBUG.LOG_PAGE_SESSION_STATE (p_level => 1);

              

            END;

            INSERT INTO MDM_DATA.REF_CMR(STORE_CD)

            (SELECT * FROM TABLE(MDM_DATA.UTIL.SPLIT(:P401_STORE_LIST,':')));

            COMMIT;

             

            UPDATE MDM_DATA.REF_CMR

            SET CMR_MARKET = NVL(:P400_CURRENT_MKT,:P400_NEW_MKT_NAME)

            WHERE UPPER(CMR_MARKET) = 'UNASSIGNED';

             

            UPDATE MDM_DATA.REF_CMR RC

            SET RC.CITY_NM = (SELECT CITY_NM FROM MDM_DATA.MD_STORE S WHERE S.STORE_CD = RC.STORE_CD)

            WHERE RC.CITY_NM IS NULL;

            COMMIT;

            </code>

            • 3. Re: Runtime Debugging - How to?
              NoGot

              You may call it anywhere you want to log something usefull. In APEX page processes, in functions that called from APEX pages.

              Usually I use it before and after some critical function calls. Before i log parameters, after i log results.

              Example:

              apex_debug.message('Calling function XXX with params:'||param1);

              result := XXX(param1);

              apex_debug.message('function XXX returned:'||result);

              • 4. Re: Runtime Debugging - How to?
                swesley_perth

                Could you clarify what you mean by unavailable? What does it say?

                 

                Also check the application properties to ensure debugging is allowed.

                 

                I think you should be able to turn on debugging at all times using the URL (if the app allows it).

                 

                If you can't open the debug output using the developer toolbar, try using the view APEX_DEBUG_MESSAGES

                • 6. Re: Runtime Debugging - How to?
                  SATim

                  "APEX runtime environment enables you to run production applications, but it does not provide a web interface for administration.  A runtime environment only includes the packages necessary to run the application, making it a more hardened environment."  Hence the developer tool bar is not available.  It looks like I need to try using the APEX_DEBUG_MESSAGES per your suggestion and NoGot suggestion.  I will get back after giving that a try.