| Using the event logging service

Related topics
This topic contains the following sections relating to the wwlog_api API package: Start-Stop logging Single-Step logging Viewing logged events Logging table field names and definitions The event logging service may be used in either of two ways to log actions performed on database objects: Start-Stop logging and Single-Step logging. Start-Stop event logging You can use a combination of wwlog_api.start_log and wwlog_api.stop_log methods to have the logging service calculate the elapsed time of a logged item. Example: To calculate the elapsed time of an action to be performed on a page in Oracle Portal, before beginning the call to draw the page, call wwlog_api.start_log: l_logid := wwlog_api.start_log ( p_domain => 'Research&Development', p_subdomain => 'Expenses', p_name => '/SE_region/Incidental/Week1', p_action => 'view', p_information => 'Week1 included Memorial Day picnic', p_url => 'tools.rd_main.main?p_cornerid=772', p_deferred => true ); In this example, the page HTML has been generated and returned to the user. Inserting the log record into a table is deferred by the use of the p_deferred = true option. After calling wwlog_api.start_log, the methods that draw the page are called. After the page is drawn, the code calls wwlog_api.stop_log. wwlog_api.stop_log ( p_id => l_logid, p_row_count => 1, p_deferred => true ); Note: The wwlog_api.stop_log command must use the same p_deferred value as the wwlog_api.start_log command. Single-Step event logging Use the wwlog_api.log command to create a log record by passing all of the attributes of the log to the procedure. This technique is useful for: Logging an event that has its own way to time the event. Logging an event for which elapsed time is meaningless. Example: When logging an update to an item in Oracle Portal, the code passes the necessary values to the wwlog_api.log call: wwlog_api.log ( p_domain => 'sbr', p_subdomain => 'item', p_name => '1/2332', p_action => 'update', p_information => 'updated author', p_url => '/docs/folderA/whitepaper.doc' p_row_count => 1, p_elapsed_time => 1 ); All Oracle Portal logging routines use autonomous transactions to ensure that when an entry is saved to the transaction log, it does not modify or commit the current transaction. The logging service also automatically switches between two Portal logging tables, wwlog_activity_log1$ and wwlog_activity_log2$, based on the log interval in days that is set in the global preference store for the system: Oracle.Portal.Logging.interval. Viewing logged events Each logged event has a corresponding record which may be retrieved with the wwlog_activity_logs view. Each record may contain the following values, which are identical to event properties:
Logging table field names and definitions
id | A unique identifier for each logged event. Notes: Providers can use this property to end a previously started event. The ID is applied to logging events by the API implementation.
domain | The domain name. Notes: A domain exists for each logical service provided by Oracle Portal, for example, "wwv" and "wwf". Providers are expected to define new domains for their major services. Domain is a non-translatable string value.
sub_domain | The subdomain name. Notes: A subdomain is a defined group of objects, such as Pages, within a domain. To facilitate modularization of logged information, each domain may contain any number of subdomains. Subdomain is a non-translatable string value.
name | The object name. Within each domain and subdomain, events are logged against named objects. A name can be, but is not required to be, a non-translatable string value.
userid | The user ID for the user that was logged into the system when the logging event was started. Note: The user ID is applied to logging events by the API implementation.
session_id | The ID of the session that the user was in at the time the logging event was started. Note: The session ID is applied to logging events by the API implementation.
action | The name of the action being performed upon the object. Notes: The caller of the API should provide a value for this string. An action can be, but is not required to be, a non-translatable string value.
url | The URL for the logged object. Note: This is an optional URL string that can be used to get back to the object that was logged.
Information | A string provided by the caller of the API. Note: Information can be any string value that the caller wants to capture and include in the logging event.
start_time | The time that the logging event was started. Notes: The start_time is the current time in the time zone of the machine hosting the logging service. This value is calculated and recorded only by Oracle Portal APIs. Providers cannot record a start time to the log.
dbms_start_time | The value returned by DBMS_UTILITY.GET_TIME when the logging event was started. Notes: This information is applied to logging events by the API implementation. This value is calculated and recorded only by Oracle Portal APIs. Providers cannot record a start time to the log.
elapsed_time | The time taken to process the event, recorded in seconds. Note: In some cases, the caller of the API supplies this information, in others the API automatically determines the correct value.
row_count | Specifies the number of rows that were operated upon for the logged action. Notes: Some common logging operations such as updating, deleting, inserting or reporting operate on a number of rows. In these cases, row_count records this information. If row_count is not specified, it defaults to zero (0).
http_user_agent | The name of the Web browser being used, if known. Notes: If the logged service was invoked from a browser, this information is applied to the logging event. The API determines the browser name, as it is not provided by the user.
http_remote_ address | The remote address (host name/IP address) of the Web browser being used, if known. Notes: If the logged service was invoked from a browser, this information is applied to the logging event. The API determines the browser name, as it is not provided by the user.
language | The browser abbreviation of the NLS setting in effect at the time of the log request.
key_1 | A column intended to hold data that correlates this log record to any specified data related to the logged event. Use of this column is optional.
key_2 | A column intended to hold data that correlates this log record to any specified data related to the logged event. Use of this column is optional.
key_3 | A column intended to hold data that correlates this log record to any specified data related to the logged event. Use of this column is optional.
key_4 | A column intended to hold data that correlates this log record to any specified data related to the logged event. Use of this column is optional.
key_5 | A column intended to hold data that correlates this log record to any specified data related to the logged event. Use of this column is optional.

Note
Autonomous transactions are methods that are called and executed independently from the main body of code.

Related topics
Event logging API package | PDK PL/SQL API Reference - Home

Back to top
The PL/SQL API Reference is part of the Portal Developer Kit on Portal Studio