6 Replies Latest reply on Feb 11, 2019 12:54 PM by Sven W.

    Find line# of error

    Fahd Bahoo

      Apex 5.1.4

       

      i have a page process which is executed when the page is submitted.

      i am getting following error, which i am recording using LOGGER utility added in application properties > error handling.

       

      ORA-00060: deadlock detected while waiting for resource

      "ORA-06512: at "APEX_050100.WWV_FLOW_DYNAMIC_EXEC", line 1895

      ORA-06512: at "APEX_050100.WWV_FLOW_DYNAMIC_EXEC", line 936

      ORA-06512: at "APEX_050100.WWV_FLOW_PROCESS_NATIVE", line 71

      ORA-06512: at "APEX_050100.WWV_FLOW_PROCESS_NATIVE", line 1132

      ORA-06512: at "APEX_050100.WWV_FLOW_PLUGIN", line 2399

      ORA-06512: at "APEX_050100.WWV_FLOW_PROCESS", line 200

       

      Now the problem is above line numbers are not showing the real problematic line# of page process.

      What am i missing.

        • 1. Re: Find line# of error
          fac586

          Fahd Bahoo wrote:

           

          Apex 5.1.4

           

          i have a page process which is executed when the page is submitted.

          i am getting following error, which i am recording using LOGGER utility added in application properties > error handling.

           

          ORA-00060: deadlock detected while waiting for resource

          "ORA-06512: at "APEX_050100.WWV_FLOW_DYNAMIC_EXEC", line 1895

          ORA-06512: at "APEX_050100.WWV_FLOW_DYNAMIC_EXEC", line 936

          ORA-06512: at "APEX_050100.WWV_FLOW_PROCESS_NATIVE", line 71

          ORA-06512: at "APEX_050100.WWV_FLOW_PROCESS_NATIVE", line 1132

          ORA-06512: at "APEX_050100.WWV_FLOW_PLUGIN", line 2399

          ORA-06512: at "APEX_050100.WWV_FLOW_PROCESS", line 200

           

          Now the problem is above line numbers are not showing the real problematic line# of page process.

          What am i missing.

          We don't know.

           

          What we are missing is:

           

          • The source code of the page process
          • The source code of error handling function
          • A debug trace of page submit processing

           

          Instead of reinventing the wheel with custom logging, the first step in debugging is to trace application execution using APEX's built-in debug mode. This can be toggled by clicking the Debug switch in the developer toolbar, or setting the debug parameter in the request URL. Debug logs provide much more structured and detailed information than can be achieved by external logging, and can be customized and extended by adding instrumentation code to your applications and programs using the apex_debug API.

          • 2. Re: Find line# of error
            Fahd Bahoo

            Thanks for the reply.

             

            How can i enable debug for a specific page in an application in production. and where to see the debug information.

            • 3. Re: Find line# of error
              fac586

              Fahd Bahoo wrote:

               

              How can i enable debug for a specific page in an application in production. and where to see the debug information.

              Initiate debug mode using the URL argument as already posted above, and access the resulting traces by querying the APEX_DEBUG_MESSAGES view in SQL Developer or SQL*Plus.

              • 4. Re: Find line# of error
                Sven W.

                You need to store the error_stack and the error_backtrace with logger.

                What you are showing looks like the callstack only.

                 

                When you call logger.log_error then it switches from callstack to error stack. in some older version of logger, I remember that the error backtrace was missing.

                How exactly did you integrate logger into apex?

                Maybe add it in an exception handler to your process, instead of waiting for the apex mechanism to kick in.

                 

                Usually the backtrace looks almost identical to the error_stack (since db 12.2), but there is one important line difference, which might be the line you are looking for.

                • 5. Re: Find line# of error
                  Fahd Bahoo
                  How exactly did you integrate logger into apex?

                   

                  i am calling the following function from

                   

                  Edit Application Definition > Error Handling Function > apex_error_handling

                   

                  create or replace function apex_error_handling (

                      p_error in apex_error.t_error )

                      return apex_error.t_error_result

                  is

                      l_result          apex_error.t_error_result;

                  begin

                   

                      logger.logger.log_error( 'LOG_ERROR: ' ||p_error.message);

                     

                      ---Log Apex Session Items

                      logger.logger.log_apex_items( p_text => p_error.message, p_log_null_items =>false  );

                     

                      return l_result;

                  end apex_error_handling;

                   

                  but you seems right, it is only getting call_stack not error_stack and the error_backtrace.

                  what do you suggest ?

                   

                   

                  Maybe add it in an exception handler to your process, instead of waiting for the apex mechanism to kick in.

                   

                  i have now added logger.logger.log_error( 'LOG_ERROR: ' ||sqlerrm); in exception section also, lets see what i get from there.

                   

                  Thanks & regards for helping

                  Fahd

                  • 6. Re: Find line# of error
                    Sven W.

                    When you add log_error in the exception section, you do not need to store the error message to the message field.

                     

                    The logger framework does this automatically for you. It is enough to write something like:

                     

                    logger.logger.log_error( 'Process XY did not run sucessfully!');

                     

                     

                    The logger table will then have the complete error stack stored.

                     

                     

                    About your statement that the correct line number where the error happened is missing:
                    I know several effects that can cause that.


                    First important part is you need to see what is in the error stack and in the backtrace. Logger.log_error will concatenate the two stacks and write them to column CALL_STACK in the logger_log table. Your message will be in the TEXT column.

                     

                    Then the question is whether you don't see the line at all, of if the line is only a few rows away from the reported line.