Skip Headers

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

Previous | Next |

# A.9 j2ee-logging.xml

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`.

Typically you would want to configure the following in `j2ee-logging.xml`:

- Change the logging level for Oracle ADF packages. See Section A.9.1.1.

- Redirect the log output to a location, like a file, in addition to the default Log window in JDeveloper. See Section A.9.1.2.

- Change the directory path that determines where your log file resides. See Section A.9.1.3.

## A.9.1 Tasks Supported by the j2ee-logging.xml

The following JSF tasks are supported by the `j2ee-logging.xml` file.

### A.9.1.1 Change the Logging Level for Oracle ADF Packages

When you want to change the logging level of individual Oracle ADF packages, edit `<logger>` in the `<loggers>` element of `j2ee-logging.xml` (see Example A-17). The default level of logging is `INFO`. Oracle recommends `level="FINE"` for detailed log messages. Note that package names are hierarchically inclusive. For instance, if you change the level of `oracle.adf`, the level specified will also apply to all classes that begin with the path `oracle.adf`. To change the level of specific classes, supply the full path; for instance, a level set for the package name `oracle.adf.controller` will not apply to other branches of the `oracle.adf` package.

For details about setting logging when debugging ADF applications, see Section 16.4.1, "Creating an Oracle ADF Debugging Configuration".

Example A-17 Changing the Logging Level in j2ee-logging.xml

    <loggers>
       <logger name="oracle.adf" level="FINE" />
       ...
    </loggers>

### A.9.1.2 Redirect the Log Output

The default logger (`name="oracle"`) is associated with two handlers: one for file output and another for console output (JDeveloper Log window). By default log messages are output to both locations at the same time. When you want to redirect the output for the log messages, edit `<handler>` in the `<logger>` element of `j2ee-logging.xml` (see Example A-18). For example, you can comment out the `<handler name="oc4j-handler"/>` when you want the output to only go to the JDeveloper Log window.

Example A-18 Changing the Logger Handler in j2ee-logging.xml

    <loggers>
      <logger name="oracle" level="NOTIFICATION:1" useParentHandlers="false">
         <handler name="oc4j-handler"/>
         <handler name="console-handler"/>
      </logger>
      ...
    </loggers>

### A.9.1.3 Change the Location of the Log File

When you want to change where the log files reside, edit `<log_handler>` in the `<log_handlers>` element of `j2ee-logging.xml` (see Example A-19). The default directory for the log file is `../log/oc4j`.

Example A-19 Changing the Location of the Log File in j2ee-logging.xml

    <log_handler name="oc4j-handler"
         class="oracle.core.ojdl.loggin.ODLHandlerFactory">
      <property name="path" value="C:/temp/adf-log"/>
      <property name-"maxFileSize" value="10485760"/>