Search Results g_debug_mode




Overview

OKE_DEBUG is a PL/SQL server-side debugging utility owned by the APPS schema in Oracle E-Business Suite. In the ETRM 12.2.2 metadata it is classified as an "OTHER" API, reflecting its role as an internal diagnostic aid rather than a published business interface. The package provides the Oracle Procurement Contracts (OKE) module with a lightweight, session-scoped logging mechanism built on top of the Oracle Application Object Library logging infrastructure (FND_LOG and FND_PROFILE). Its central purpose is to allow developers and support personnel to selectively emit diagnostic messages from OKE PL/SQL code at runtime, controlled either by a user profile option or by an explicit programmatic override.

The package maintains a small set of package-level globals that are the subject of the user's search term g_debug_mode. Released as version 115.2 in October 2003, the package has remained stable across the 12.1.1 and 12.2.2 releases, and the ETRM metadata records no dependencies from other packages on it, confirming its status as a leaf-level utility.

Key Procedures and Functions

  • ENABLE_DEBUG — Forces the current session into debug mode regardless of the user profile setting. It records the current user ID and sets the debug-mode global to 'Y'.
  • DISABLE_DEBUG — Forces the current session out of debug mode regardless of the profile setting, capturing the user ID and setting the debug-mode global to 'N'.
  • DEBUG_MODE — A function returning VARCHAR2 that reports whether debug mode is active. If the cached global is null or the cached user ID does not match the current session user, it re-reads the profile option OKE_DEBUG_MODE, defaulting to 'N', and refreshes the cache. An exception handler returns 'N' on any error, ensuring debugging never disrupts normal processing.
  • DEBUG — The workhorse logging procedure. It accepts text, a module name, and a log level, and delegates output to FND_LOG.STRING. A message is written only when the supplied log level meets or exceeds the current runtime level, or when debug mode is enabled. Module names default to 'oke.plsql.generic', and all exceptions are swallowed.

Tables Accessed

The ETRM metadata lists no direct table references for this package. The only persistent data it reads is the OKE_DEBUG_MODE user profile option, retrieved through FND_PROFILE.VALUE, which resolves to values stored in the FND profile option tables. All other state — G_User_ID, G_Debug_Mode, G_Module, G_Log_Level, and G_Runtime_Level — resides in package memory for the duration of the database session. Log output is routed to the FND logging subsystem rather than to any OKE application table.

Usage Notes

OKE_DEBUG is typically invoked from OKE forms, concurrent programs, and custom PL/SQL that requires conditional diagnostics without permanently altering code. Because g_debug_mode is cached per session and re-validated against FND_GLOBAL.User_ID, the package correctly handles connection pooling and shared sessions: a change of effective user forces the profile option to be re-read. Developers can call ENABLE_DEBUG at the start of a session or test script to bypass the profile setting entirely, and DISABLE_DEBUG to restore normal behaviour. Because DEBUG_MODE and DEBUG both suppress internal exceptions, the utility is safe to leave embedded in production code paths; output volume is governed by the runtime log level maintained by FND_LOG.