locked
How to configure database to use Logging Application Block RRS feed

  • Question

  • User-1908152456 posted

    Hi

    someone have a example of the script that create database infra-structure to use Logging Application Block?

    Or create a simple table with fields:

     @EventID int,
     @Priority int,
     @Severity nvarchar(32),
     @Title nvarchar(256),
     @Timestamp datetime,
     @MachineName nvarchar(32),
     @AppDomainName nvarchar(512),
     @ProcessID nvarchar(256),
     @ProcessName nvarchar(512),
     @ThreadName nvarchar(512),
     @Win32ThreadId nvarchar(128),
     @Message nvarchar(1500),
     @FormattedMessage ntext

    and the SP below to insert data in this table is sufficient?

    1    CREATE PROCEDURE [dbo].[WriteLog]
    2    (
    3     @EventID int, 
    4     @Priority int, 
    5     @Severity nvarchar(32), 
    6     @Title nvarchar(256), 
    7     @Timestamp datetime,
    8     @MachineName nvarchar(32), 
    9     @AppDomainName nvarchar(512),
    10    @ProcessID nvarchar(256),
    11    @ProcessName nvarchar(512),
    12    @ThreadName nvarchar(512),
    13    @Win32ThreadId nvarchar(128),
    14    @Message nvarchar(1500),
    15    @FormattedMessage ntext,
    16    @LogId int OUTPUT
    17   )
    18   AS
    
    Already exists any script for this task?
    Thanks
    Friday, September 26, 2008 1:59 PM

Answers

  • User-1908152456 posted

    [ SOLVED ]

    I extract sources from EntLib and found the scripts to create the infra-strucuture in directory.

    D:\EntLib4Src\Blocks\Logging\Src\DatabaseTraceListener\Scripts

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 26, 2008 2:56 PM

All replies

  • User-1908152456 posted

    [ SOLVED ]

    I extract sources from EntLib and found the scripts to create the infra-strucuture in directory.

    D:\EntLib4Src\Blocks\Logging\Src\DatabaseTraceListener\Scripts

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 26, 2008 2:56 PM
  • User-1033505902 posted

    can you guide me with an example of how to log exception into sql server using enterprise library

    please guide me with some code example or some demo

    Thursday, February 19, 2009 11:09 PM
  • User-1908152456 posted

    After configure Logging App Block with Enterprise Library Configuration you can use like below  

    LogEntry logEntry = new LogEntry();
    
    logEntry.Severity = System.Diagnostics.TraceEventType.Information;
    logEntry.ProcessName = "Section XYZ from your project";
    logEntry.Title = "Title";
    logEntry.Categories.Add("General");
    logEntry.Message = string.Format("Your Message");
    logEntry.TimeStamp = DateTime.Now;
    
    Logger.Write(logEntry);
     
    Friday, February 20, 2009 9:14 AM