Friday, February 01, 2008

FND Logging

Oracle application version 11.5.9 provides a general debug message logging system. Using this system a Form or Pl/sql package can be debugged with much ease. It provides good control to Developers. This debugging system uses following profile options, a package and a database table.

Debug Profile Options
Default value of these profile option does not lead to any debug messages. These profile option should be rarely changed at Site level. Most of the time user level values should be changed so that a particular user’s activity can be logged and analyzed. When log messages are not needed, these profile options should be set back to default values so that debug message logging stops.

Profile Option Description

      FND: Debug Log Enabled
      Using this profile option, Logging of debug message can be turned ON or OFF. This profile is available at user level

      FND: Debug Log Level
      This profile describes what kind of message will be logged when logging is enabled. There are six level of logging. These levels are

      1. Statement – Set log level to statement when you need to see how your code inside a procedure is flowing.

      2. Procedure – Set log level to Procedure when you are interested in knowing the value of input and output parameters of a procedure

      3. Event – This could be used when you want to check if certain event has taken place, Such as a button is pressed in a form.

      4. Exception – This should be used when you want to log all the exception encountered by a particular module.

      5. Error – This should be used when you want to log all the error encountered by a particular module.

      6. Unexpected – This is used for logging all the unexpected condition

      FND: Debug Log Module
      This is the name of object/module that should log the debug messages. This could be a procedure or package or trigger or Form or report or Java class. This profile option can have partial name of module that should log the messages. While setting this profile option, please be careful to avoid unnecessary logging. For example, setting this profile to ‘xyz’ could possibly log message from all the modules that have name as 'xyz%'. It is better if this profile option can have a value close to the object name that should log messages. If this profile option is % then all module can log messages if Debug log is enabled.

      If you need to log multiple module at the same time then set thus profile option as '%module1,%module2, %module3' to log message for '%module1%', '%module2' and '%module3'

      FND: Debug Log Mode
      This profile option tells if message should be logged in Synchronous or Asynchronous mode. For performance reasons, it should be Asynchronous.

      FND: Debug Log filename
      This profile option is set to a valid file, then message are written to a file instead of database.

Logging Package FND_LOG
This package is used by pl/sql code to write debug messages. The main components of the package are

Logging Package Constants

This package has 6 global constants for Debug Level

Lowest level of logging is LEVEL_STATEMENT. This level generates most of the debug messages. LEVEL_UNEXPECTED is the highest level of debugging and it generates fewest messages.

This package has one global variable to give current Log level. The constant is G_CURRENT_RUNTIME_LEVEL. This can be equal to any of the debug level. By default it is set to LEVEL_UNEXPECTED

Logging Package Function TEST
This function is used to determine if Debug Log is enabled for a given module and level. If logging is enabled for given module and level then it return TRUE otherwise FALSE is returned by this function. If logging is enabled for a given level and module, only then messages should be logged. Parameters to this procedure are

LOG_LEVEL: This could be any of six logging levels
MODULE: This is the name of the module.
Logging Package Procedure String
This procedure actually writes the debug log message. The parameters to this procedure are

LOG_LEVEL: Log level applicable to the message
MODULE: Name of the module that is creating Debug log messages
MESSAGE: The message to be logged. Before calling this procedure, message could be constructed using any complex concatenation of strings

The log messages are stored in the table FND_LOG_MESSAGES. The log messages could be retrieved based on module or user. While retrieving the log message, timestamp too should be included into selection criterion so that past messages are discarded.

Sample Pl/Sql Code with LOG Messages

How to delete old FND Log messages?
Run concurrent program Purge Debug Log

No comments:

Post a Comment