Enterprise library records logs to Oracle databases

Source: Internet
Author: User

The Enterprise Library of Enterprise Library does not provide an SQL script to record logs to the Oracle database. To enable logging to the Oracle database, write the following script:

spool DDD.logpromptprompt Creating table ORACLE_ENTLOGprompt ============================promptcreate table ORACLE_ENTLOG(  ID                 NUMBER,  EVENTID            NUMBER,  PRIORITY           NUMBER,  TITLE              NVARCHAR2(500),  MESSAGE            NVARCHAR2(1000),  MACHINE            NVARCHAR2(100),  TIMESTAMPS         DATE,  SEVERITY           NVARCHAR2(100),  APPLICATIONDOMAIN  NVARCHAR2(1000),  PROCESSID          NVARCHAR2(256),  PROCESSNAME        NVARCHAR2(500),  WIN32THREADID      NVARCHAR2(128),  THREADNAME         NVARCHAR2(500),  EXTENDEDPROPERTIES NVARCHAR2(1000),  CATEGORY           NVARCHAR2(1000))tablespace SYSTEM  pctfree 10  pctused 40  initrans 1  maxtrans 255  storage  (    initial 64K    next 8K    minextents 1    maxextents unlimited    pctincrease 50  );promptprompt Creating sequence SEQ_ENTLOGprompt ============================promptcreate sequence SEQ_ENTLOGminvalue 1maxvalue 9999999999999999999999start with 1increment by 1cache 20;promptprompt Creating procedure ADDCATEGORYprompt ==============================promptcreate or replace procedure AddCategory(    categoryName   in     nvarchar2,    logID            in    number)asbegin    UPDATE oracle_entlog SET Category=categoryName WHERE ID=logID;    commit;end;/promptprompt Creating procedure WRITELOGprompt ===========================promptCREATE OR REPLACE PROCEDURE WRITELOG(    LogId     out         number,    EventId   in         number,    Priority       in         number,    Title         in           nvarchar2,    Message       in         nvarchar2,    machineName    in        nvarchar2,    timestamp      in    Date,    Severity        in        nvarchar2,    AppDomainName   in         nvarchar2,    ProcessId       in         nvarchar2,    ProcessName      in      nvarchar2,    Win32ThreadId    in        nvarchar2,    ThreadName       in         nvarchar2,    formattedmessage  in      nvarchar2)isbegin    insert into oracle_entlog    (        ID,        EventId,        Priority,        Title,        Message,        Machine,        Timestamps,        Severity,        ApplicationDomain,        ProcessId,        ProcessName,        Win32ThreadId,        ThreadName,        ExtendedProperties       )    values    (        seq_entlog.Nextval,        EventId,        Priority,        Title,        Message,        machineName,        timestamp,        Severity,        AppDomainName,        ProcessId,        ProcessName,        Win32ThreadId,        ThreadName,        formattedmessage          );             commit;           select seq_entlog.Currval into LogId from dual;      end  WriteLog;/spool off

Use the same method as inserting logs into sqlserver.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.