Logging Through the CIO

This chapter describes how you can use the Oracle Applications Logging Framework with Oracle Configurator and the Oracle Configuration Interface Object to provide a convenient and uniform interface for logging their activity.

This chapter covers the following topics:

Overview of Logging

This chapter provides basic information about logging the operations you perform with the CIO, especially those inside Configurator Extensions.

Oracle Configurator and the Oracle Configuration Interface Object use the Oracle Applications Logging Framework to provide a convenient and uniform interface for logging their activity.

For references to Oracle documentation about the Oracle Applications Logging Framework, see Troubleshooting.

Logging through the CIO requires these essential actions:

These actions are illustrated together by Example of Logging.

Note: Logging through the CIO is primarily intended for use within Configurator Extensions, but you can also use it in custom applications that use the CIO directly. See Logging for a Custom Application.

Enabling Logging Scope

In order to enable the creation of log entries through the CIO you must set the following parameters for the Oracle Applications Logging Framework:

These parameters can be set as middle-tier properties or as database profile options. The parameter names listed here are for middle-tier properties. See the Oracle E-Business Suite Developer's Guide for information on how to set these parameters as database profile options.

The table Values for AFLOG_MODULE lists the strings that you can include in the AFLOG_MODULE parameter to identify the Java packages or classes that you wish to log. The AFLOG_MODULE parameter is a comma-delimited filter against which the module names of log messages are compared.

Values for AFLOG_MODULE
Value Description
cz% Logs with attribution to the log-writing method Configuration.writeCXLogEntry(). This setting logs all activity by Oracle Configurator during a configuration session, regardless of which class in your Configurator Extension or custom application caused the entry to be written. Allows you to examine the activity of your classes in the context of Oracle Configurator activity.
The Oracle Applications Logging Framework ignores oracle.apps. at the beginning of a package name, so to specify oracle.apps.cz.cio, you only specify cz.cio.
Examples:
cz%
cz.cio%
packagepath% Logs with attribution to the methods in your own Configurator Extension or custom application classes that caused the entry to be written. This setting logs only activity by your Configurator Extension or custom application during a configuration session and omits the surrounding activity by Oracle Configurator.
Examples:
acme%
acme.rocket%

The table Values for AFLOG_LEVEL lists the Oracle Applications Logging Framework logging levels in order of increasing severity. You must specify one of the supported levels when enabling logging through the CIO.

Values for AFLOG_LEVEL
Value Description
STATEMENT Used for low-level progress reporting.
PROCEDURE Used for API-level progress reporting.
EVENT Used for high-level progress reporting.
EXCEPTION Not supported. Indicates a handled internal software failure.
ERROR Not supported. Indicates an external end user error.
UNEXPECTED Not supported. Indicates unhandled internal software failure.

Caution: Logging through the CIO does not support use of the more severe logging levels provided by the Oracle Applications Logging Framework, namely: EXCEPTION, ERROR, and UNEXPECTED.

See Troubleshooting for references to more information about AFLOG_MODULE.

Creating Entries in the Log

Creating entries in the log requires performing these essential actions in your Configurator Extension or custom application code:

In the Oracle Applications Logging Framework, the term module refers to a Java class when it is applied to a Java framework, so that term is used for consistency in the descriptions in this section.

Testing Whether Logging Is Enabled

You test whether logging is enabled by calling the method Configuration.isCXLogEnabled(). The syntax for this method is as follows:

public final boolean isCXLogEnabled(module, logLevel)

Parameters for isCXLogEnabled() describes the parameters for this method. Notice that the parameter module can be either an Object or a String. There are separate signatures of isCXLogEnabled() for each data type.

The table Logging Through the CIO provides an example of how to use this method.

Parameters for isCXLogEnabled()
Data Type Parameter Description
Object or String module If you pass an Object, this parameter specifies the Java class to which the log entry will attributed. The typical value for this parameter is the Java keyword this.
If you pass a String, this parameter specifies the fully-qualified name of the Java class, including its package, to which the log entry will attributed. This form is provided for use with static methods, since Java technology does not allow the use of the keyword this in static methods.
A runtime exception is raised if this parameter is null.
This description also applies to the parameter of the same name in Parameters for writeCXLogEntry().
int logLevel The level of detail at which logging is enabled. Must be one of the following constants:
  • Configuration.CXLOG_STATEMENT

  • Configuration.CXLOG_PROCEDURE

  • Configuration.CXLOG_EVENT


The specified level must correspond to one of the supported levels specified for AFLOG_LEVEL, as listed in Values for AFLOG_LEVEL. For example, if you specify Configuration.CXLOG_STATEMENT for this parameter, then AFLOG_LEVEL must specify STATEMENT.
A runtime exception is raised if this parameter specifies an unsupported level.
This description also applies to the parameter of the same name in Parameters for writeCXLogEntry().

Writing Log Entries

You write an entry by calling the method Configuration.writeCXLogEntry(). The syntax for this method is as follows:

public final void writeCXLogEntry(module, methodName, label, message, logLevel)

The table Parameters for writeCXLogEntry() describes the parameters for this method. Notice that the parameter module can be either an Object or a String. There are separate signatures of writeCXLogEntry() for each data type.

Logging Through the CIO provides an example of how to use this method.

Parameters for writeCXLogEntry()
Data Type Parameter Description
Object or String module See the description of the parameter of the same name in Parameters for isCXLogEnabled().
String methodName The name of your Java method that is calling writeCXLogEntry(). This name is written to the log.
A runtime exception is raised if this parameter is null or consists of white space.
String label An optional string. Use to provide additional context for the entry in the log.
String message An optional string. Use to write the log message that describes the situation being logged.
int logLevel See the description of the parameter of the same name in Parameters for isCXLogEnabled().

Recommended Practices for Logging

When logging through the CIO, you should follow these practices:

Example of Logging

The example Logging Through the CIO illustrates how your code can use the logging methods described in Creating Entries in the Log. These methods are highlighted typographically in . The example also highlights these requirements:

Logging Through the CIO

package acme.code;
import oracle.apps.cz.cio.Configuration;
import oracle.apps.cz.cio.IRuntimeNode;
 
public class MyClass {
    // ... other code here to interact with configuration ...
    public void selectIt(IRuntimeNode rtNode) {
        Configuration cfg = rtNode.getConfiguration();
        // ... other code here to select a node ...
        if (cfg.isCXLogEnabled(this, Configuration.CXLOG_STATEMENT)) {
            cfg.writeCXLogEntry(this, 
                                "selectIt", 
                                null,
                                "Selecting a node.",   
                                Configuration.CXLOG_STATEMENT); 
        }
    }
}

Log File Entry When AFLOG_MODULE Includes cz% and Log File Entry When AFLOG_MODULE Includes acme% show the log entries produced by the code fragment in Logging Through the CIO, with differing settings for AFLOG_MODULE, as described in Enabling Logging Scope.

Log File Entry When AFLOG_MODULE Includes cz%

[Oct 28, 2004 9:53:58 AM PDT] : 1098982438703:Thread[HttpRequestHandler-94,5,main]: -1: -1: ap723jdv: 139.185.20.44: -1:-1: STATEMENT:[cz.cio.Configuration.writeCXLogEntry]:[null_4e9d2fd_2 1 2] CXLog> [acme.code.MyClass.selectIt] Selecting Option 1

In Log File Entry When AFLOG_MODULE Includes cz%:

Log File Entry When AFLOG_MODULE Includes acme%

[Oct 28, 2004 9:53:58 AM PDT] : 1098982438703:Thread[HttpRequestHandler-94,5,main]:-1: -1: ap723jdv: 139.185.20.44: -1:-1: STATEMENT:[acme.code.MyClass.selectIt]:[null_4e9d2fd_2 1 3] Selecting Option 1

In Log File Entry When AFLOG_MODULE Includes acme%:

Logging for a Custom Application

Logging through the CIO is primarily intended for use within Configurator Extensions operating against a generated Oracle Configurator user interface, but you can also use logging in custom applications that use the CIO directly against a custom user interface.

Note: Custom applications that have previously used the CZLog object should instead use the logging framework described in this chapter. The CZLog object is now deprecated.

Logging through a custom application is similar to the logging described in this chapter, especially in Creating Entries in the Log and Values for AFLOG_LEVEL, but with the following differences:

For an example of custom logging, see the code fragment under Logging Through the CIO for a Custom Application, and compare it to the example code shown under Logging Through the CIO.

Logging Through the CIO for a Custom Application

package acme.code;
import oracle.apps.cz.cio.Configuration;
import oracle.apps.cz.cio.IRuntimeNode;
import oracle.apps.cz.utilities.NonCtxLogWriter;
import oracle.apps.cz.utilities.LogWriter;
 
public class MyClass {
    // ... other code here to interact with configuration ...
    public void selectIt(IRuntimeNode rtNode) {
        Configuration cfg = rtNode.getConfiguration();
        // ... other code here to select a node ...

        // Create a logging object
        NonCtxLogWriter nclw = new NonCtxLogWriter(); 
        if (nclw.isEnabled(LogWriter.STATEMENT, this)) {
            nclw.write(this, 
                       "selectIt",
                        null,
                        "Selecting a node.",
                        LogWriter.STATEMENT);
        }
    }
}