| Last Update: | Jul 27, 2003 |
| Status: | Production |
| Version: | Any PDK Release |
Oracle9iAS Portal provides a set of APIs for logging events that occur during transactions with its objects. These logs are stored in the database and are available through standard SQL calls and reporting tools.
You can choose the events you would like to log and organize them categorically based on user-defined domains and sub-domains. While viewing the logged events, you can view information about the event, the time the event started and stopped, the host/IP address of the remote user, the type of browser being used, and the language used when the event occurred.
For an introductory overview of Event Logging Services, please refer to the Primer on Event Logging.
Event logging services are available through the wwlog_api & wwlog_api_admin packages.
This article describes how the Event Logging services are implemented using the Services Example. It provides a guideline for adding the Event Logging service to your portlet functionality.The general model for working with the event logging can be described as follows:
CREATE OR REPLACE
package body SERVICES_PORTLET
is
-- Constants --
DOMAIN constant varchar2(30) := 'provider';
SUBDOMAIN constant varchar2(32) := 'services';
...
procedure save_prefs
(
p_string in varchar2,
p_title in varchar2,
p_back_url in varchar2,
p_page_url in varchar2,
p_action in varchar2,
p_request in varchar2,
p_language in varchar2,
p_reference_path in varchar2,
)
is
l_time varchar2(20) := to_char (sysdate,'DD.MM.YYYY-HH24:MI');
l_action varchar2(15);
l_url varchar2(256) := p_back_url;
l_row_count integer := 1;
l_elapsed_time number := 0;
l_user varchar2(30) := wwctx_api.get_user;
...
begin
if ((p_action = 'finish') or (p_action = 'apply')) then
...
if (l_prefs.string_id is null or to_number(l_prefs.string_id) = 0)
then
l_action := 'insert';
...
else -- string exists in at least one language
l_action := 'update';
...
end if;
l_information := l_user||'%'||l_time||'%completed%'||p_title;
wwlog_api.log (p_domain => DOMAIN,p_subdomain => SUBDOMAIN,
p_name => l_user,
p_action => l_action,
p_information => l_information,
p_url => l_url,
p_row_count => l_row_count,
p_elapsed_time=> l_elapsed_time);
if p_action = 'finish' then...
end save_prefs;
...
end SERVICES_PORTLET;
/
CREATE OR REPLACE
package body SERVICES_PORTLET
is
...
procedure save_prefs
(
...
)
is
...begin
...
exception
when INVALID_TEXT_EXCEPTION then
l_information := l_user||'%'||l_time
||'%INVALID_TEXT_EXCEPTION%'||p_string;
l_action := 'failed';
wwlog_api.log (p_domain => DOMAIN,p_subdomain => SUBDOMAIN,
p_name => l_user,
p_action => l_action,
p_information => l_information,
p_url => l_url,
p_row_count => 0,
p_elapsed_time=> l_elapsed_time);
end save_prefs;
...
end SERVICES_PORTLET;
/
| Revision History: |
|
| Oracle Corporation World Headquarters 500 Oracle Parkway Redwood Shores, CA 94065, USA http://www.oracle.com/ |
Worldwide Inquiries: 1-800-ORACLE1 Fax 650.506.7200 |
Copyright and Corporate Info |