Skip Headers

# Using Session Logging API

Previous

Next

If you use TopLink native logging (the default), then at run time, you can configure logging options using `oracle.toplink.sessions.Session` logging API.

The `Session` interface defines the following logging methods:

- `setSessionLog`–specify the type of logging to use (any implementor of `oracle.toplink.logging.SessionLog`)

- `dontLogMessages`–disable logging

- `setLog`–specify the `java.io.Writer` to which the session logs messages

- `setLogLevel`– specify the level at which the session logs using `oracle.toplink.logging.SessionLog` constants:

  - `OFF`

  - `SEVERE`

  - `WARNING`

  - `INFO`

  - `CONFIG`

  - `FINE`

  - `FINER`

  - `FINEST`

  - `ALL`

Example: Configuring a Session to Use java.util.logging illustrates how to configure a session to use `java.util.logging` package.

Configuring a Session to Use java.util.logging

    session.setSessionLog(new JavaLog());

Example: Configuring a Session to Use Application Server Logging illustrates how to configure a session to use the server log that OC4J provides. For more information about server logging, see "Server Logging".

Configuring a Session to Use Application Server Logging

    session.setSessionLog(new OjdlLog());

Example: Configuring a Session to Log to a java.io.Writer illustrates how to configure a session to log to a `java.io.Writer`:

Configuring a Session to Log to a java.io.Writer

    session.setLog(myWriter);