Skip Headers

Oracle® Application Development Framework Developer's Guide 10g Release 3 (10.1.3) B25386-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# 16.4 Understanding a Typical Oracle ADF Model Debugging Session

If you are not able to easily find the error in your web page or its corresponding page definition file, you can use the JDeveloper debugging tools to investigate where your application failure occurs. Specifically, the goal for debugging the interaction between the web page and the Oracle ADF Model layer is to pause the application by setting breakpoints on the execution of the Oracle ADF page lifecycle and to examine the data loaded at runtime. When the objects of the Oracle ADF Model layer do not contain the data that you expect to see , this observation will help you to identify the probable contributing factor.

Generally, the process for debugging proceeds like this:

1. Run the application and look for missing or incomplete data, actions and methods that are ignored or incorrectly executed, or other unexpected results.

2. Create a debugging configuration that will enable the ADF Log and send Oracle ADF Model messages to the JDeveloper Log window. For more information, see Section 16.4.1, "Creating an Oracle ADF Debugging Configuration".

3. Choose Go to Java Class from the Navigate menu (or press Ctrl + -) and use the dialog to locate the Oracle ADF class that represents the entry point for the processing failure.

   Tip: JDeveloper will locate the class from the user interface project that has the current focus in the Application Navigator. If your workspace contains more than one user interface project, be sure the one with the current focus is the one that you want to debug.

4. Open the class file in the Java editor and find the Oracle ADF method call that will enable you to step into the statements of the method.

5. Set a breakpoint on the desired method and run the debugger.

6. When the application stops on the breakpoint, use the Data window to examine the local variables and arguments of the current context.

Once you have set breakpoints to pause the application at key points, you can proceed to view data in the JDeveloper Data window. To effectively debug your web page's interaction with the Oracle ADF Model layer, you need to understand:

- The Oracle ADF page lifecycle and the method calls that get invoked

- The local variables and arguments that the Oracle ADF Model layer should contain during the course of application processing

Awareness of Oracle ADF processing, as described in Section 16.5, "Debugging the Oracle ADF Model Layer", will give you the means to selectively set breakpoints, examine the data loaded by the application, and isolate the contributing factors.

Note: JSF web pages may also use backing beans to manage the interaction between the page's components and the data. This chapter does not address debugging backing beans.

## 16.4.1 Creating an Oracle ADF Debugging Configuration

ADF Faces leverages the Java Logging API (`java.util.logging.Logger`) to provide logging functionality when you run a debugging session. Java Logging is a standard API that is available in the Java Platform, starting with JDK 1.4. For the key elements, see the section "Java Logging Overview" at `http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html`.

Because standard Java Logging is used, you can edit the `j2ee-logging.xml` file to control the level of diagnostics you receive in the Log window:

- When you conduct a debugging session within JDeveloper, you will use JDeveloper embedded-OC4J and will want to modify the file in your JDeveloper install here:

  `<JDev_Install>``/jdev/system/oracle.j2ee.10.1.3.xx.xx/embedded-oc4j/config`

- Similarly, when you want to conduct a remote debugging session on Oracle Application Server, you can modify the file here:

  `<OAS_Home>``/j2ee/<OC4J_INSTANCE>/config`

- Or, when you want to conduct a remote debugging session on standalone OC4J, you can modify the file here:

  `<OC4J_Home>``/j2ee/home/config`

To edit ADF package-level logging in the j2ee-logging.xml file:

If you want to change the logging level for Oracle ADF, you can edit the `<logger>` elements of the configuration file.

Note: By default the level is set to `INFO` for all packages of Oracle ADF. However, Oracle recommends `level="FINE"` for detailed logging diagnostics.

For the packages `oracle.adf.view.faces` and `oracle.adfinternal.view.faces`, edit:

`<logger name="oracle.adf" level="INFO"/><logger name="oracle.adfinternal" level="INFO"/>`

For the Oracle ADF Model layer packages, edit these elements:

`<logger name="oracle.adf" level="INFO"/><logger name="oracle.jbo" level="INFO"/>`

Altenatively, you can create a debug configuration in JDeveloper that you can choose when you start a debugging session.

To create an Oracle ADF Model debugging configuration:

1. In the Application Navigator, double-click the user interface project.

2. In the ProjectProperties dialog, click Run/Debug and create a new run configuration, for example, named ADF debugging.

3. Double-click the new run configuration to edit the properties.

4. In the Edit Run Configuration dialog, for Launch Settings, enter the following Java Options for the default ojvm virtual machine:

   `-Djbo.debugoutput=adflogger -Djbo.adflogger.level=FINE`

   Oracle recommends the `level=FINE` for detailed diagnostic messages.