14-9. Viewing Errors for Debugging Web Apps

Problem

You have a PL/SQL package or procedure called from a web client that generates errors and you need to view the error message.

Solution

Choose one of the following two solutions, depending on your circumstances.

Solution #1

If the package is in use in a production environment, then check the output of the Apache error log file. The log file location is defined in the httpd.conf configuration file. The default log file location is [oracle_home]ApacheApachelogs directory. Open the log file and search for the errors generated with a timestamp that corresponds to the approximate time the error was generated.

Solution #2

If the application is in development or running in a non-production environment, change the default error style within the DAD used to produce the web page that failed. The error style is defined in the DADS.CONF file located in [oracle_homme]Apachemodplsqlconf. Set the PlsqlErrorStyle to DebugStyle.

Image Note See recipe 14-1 for more information on defining DADs.

How It Works

Solution #1

The PL/SQL module within Apache logs all errors, complete with timestamps. New errors are written to the end of the error log. This solution is recommended for production environments where the display of Apache environment variables may pose security issues.

Here's an example of an error message written to the error log. In this example, a procedure was called from the Web but was missing required parameters.

[error] [client 127.0.0.1] mod_plsql: /DAD_NAME/class_sched.list HTTP-404

class_sched.list: SIGNATURE (parameter names) MISMATCH
VARIABLES IN FORM NOT IN PROCEDURE:
NON-DEFAULT VARIABLES IN PROCEDURE NOT IN FORM: THIS_ID, THIS_ID_TYPE
Solution #2

Setting the PlsqlErrorStyle to DebugStyle causes Apache to display all PL/SQL error messages on the client's web browser when the PL/SQL routine fails. It displays the same error messages normally found in the Apache log file plus a list of all Apache environment variables and their values. This solution is recommended for non-production environments where errors are more likely to occur during development and testing. It has the advantage of immediate, onscreen feedback for developers and testers.

The following is an example of an error message written to the web browser.

class_sched.list: SIGNATURE (parameter names) MISMATCH
VARIABLES IN FORM NOT IN PROCEDURE:
NON-DEFAULT VARIABLES IN PROCEDURE NOT IN FORM: THIS_ID, THIS_ID_TYPE

  DAD name: default
  PROCEDURE  : class_sched.list
  URL        : http://node.mycomp.com/DAD_NAME/class_sched.list
  PARAMETERS :
  ===========

  ENVIRONMENT:
  ============
    PLSQL_GATEWAY=WebDb
    GATEWAY_IVERSION=3
        << snip >>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.171.130