Previous Next JavaScript must be enabled to correctly display this content

## 24.2.9 Using APEX_DEBUG When Developing Your Application

Learn about APIs in the `APEX_DEBUG` package.

The `APEX_DEBUG` package contains APIs that you can utilize when developing your application and add application-specific debug messages to the APEX Debug Log. Custom application debug messages will be recorded alongside messages emitted by the APEX engine.

- Programmatically Enabling or Disabling Debugging for a Call
  Learn about enabling or disabling debugging for a call.
- Programmatically Enabling or Disabling Debugging for a Specific Session
  Learn about enabling or disabling debugging on a specific session.
- Logging Messages
  Learn about sever-side and client-side logging.

Parent topic: Utilizing Debug Mode

### 24.2.9.1 Programmatically Enabling or Disabling Debugging for a Call

Learn about enabling or disabling debugging for a call.

You can use the following methods to enable or disable debugging:

- `APEX_DEBUG.ENABLE` - This procedure enables debug messaging. You can specify the types of debug messages that are logged by level of importance.
- `APEX_DEBUG.DISABLE` - This procedure disables debug messaging.

Note you only need to call `APEX_DEBUG.ENABLE` once to enable debugging for the duration of the APEX request.

Related Topics

- ENABLE Procedure Oracle APEX API Reference
- DISABLE Procedure in Oracle APEX API Reference

See Also:

and in Oracle APEX API Reference.

Parent topic: Using APEX_DEBUG When Developing Your Application

### 24.2.9.2 Programmatically Enabling or Disabling Debugging for a Specific Session

Learn about enabling or disabling debugging on a specific session.

You can use `APEX_SESSION.SET_DEBUG` to enable or disable debugging on a specific session. This is useful when debugging issues only reproducible for other users. Note that the higher the debug level, the more resources pages will consume to be rendered and pages will noticeable slow down.

Related Topics

- APEX_DEBUG in Oracle APEX API Reference

Parent topic: Using APEX_DEBUG When Developing Your Application

### 24.2.9.3 Logging Messages

Learn about sever-side and client-side logging.

Server-side Logging

You can use the following APIs to aid with debugging your application. You can use these APIs in application components such as processes and dynamic content regions as well as in your PL/SQL packages. These APIs will record debug information only when debugging is enabled for given APEX session or at the APEX instance level.

- `APEX_DEBUG.ERROR` - Logs messages on LEVEL1. It can be used to log unrecoverable application error messages to the debug log.
- `APEX_DEBUG.WARN` - Logs messages on LEVEL2. It can be used to log recoverable application error messages to the debug log.
- `APEX_DEBUG.INFO` - Logs messages on LEVEL4. It can be used to log messages about the status of a process or operation to the debug log.
- `APEX_DEBUG.ENTER` - Logs messages on LEVEL5. It is used to log the names and parameters of methods that are "entered" and is tyìcally found to be the first statement in a procedure's or function's begin block
- `APEX_DEBUG.TRACE` - Logs messages on LEVEL6. It is used to log very detailed information about a process or operation to the debug log.

If you want to log a debug message at a debug level that is not known until runtime, use the general `APEX_DEBUG.MESSAGE` procedure. If you want to log a message that is longer than 4,000 characters, use `APEX_DEBUG.LOG_LONG_MESSAGE` procedure.

To view or query the collected custom debug messages, see Viewing Debug Messages.

See Also:

APEX_DEBUG in Oracle APEX API Reference

Client-side Logging

You can also use the `apex.debug` JavaScript API to instrument your JavaScript code so that messages can show in the browser developer console only when the appropriate debug level is set. For example, you can incorporate apex.debug calls in your JavaScript code that is executed from Dynamic Actions.

Related Topics

- APEX_DEBUG in Oracle APEX API Reference
- apex.debug in Oracle APEX JavaScript API Reference

Parent topic: Using APEX_DEBUG When Developing Your Application