|
This topic contains the following sections relating to the wwlog_api
API package:
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:
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:
|
|
domain |
The domain name.
Notes:
|
|
sub_domain |
The subdomain name.
Notes:
|
|
name |
The object name.
|
|
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:
|
|
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:
|
|
dbms_start_time |
The value returned by DBMS_UTILITY.GET_TIME when the logging event
was started.
Notes:
|
|
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:
|
|
http_remote_
address |
The remote address (host name/IP address) of the Web browser being
used, if known.
Notes:
|
|
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. |
|