Subscribe | Alerts via Email
View All Quotes
“An expert is a man who has made all the mistakes that can be made in a very narrow field.”
-Niels Bohr
<July 2010>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

©2010 Cal Zant
Sign In
Total Posts: 106
This Year: 5
This Month: 1
This Week: 0
Comments: 2

I was trying to add a Database Trace Listener to my Enterprise Library Logging Application Block, and had a hard time figuring out what the signature of the two stored procedures it references were supposed to look like.  Here are the procedures that I am referring to, AddCategoryStoredProcedure and WriteLogStoredProcedureName:

I finally just opened up the source code for the Enterprise Library itself to look what it was going to try to pass those procedures, and then created procedures that had the parameters it expected.  To save you the same trouble ... here is what those procedures are supposed to look like:

CREATE PROC [dbo].[WriteLog]
@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,
@LogId int OUTPUT
AS

-- Add logic here to insert the values into the appropriate table

-- Set the ID the DB automatically assigned to the log entry so it
--
can be returned as an output parameter
SET @LogID = SCOPE_IDENTITY()

Then here is the one that tags the log with one or more categories:

CREATE PROC [dbo].[AddCategory]
@CategoryName varchar(MAX),
@LogID int
AS

-- Add logic here to insert the values into the appropriate table

Friday, September 18, 2009 12:13:54 PM (Central Standard Time, UTC-06:00)  #