1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
| /****** Object: Table [dbo].[tbData_Debug] Script Date: 02/12/2009 22:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbData_Debug](
[colTimeStamp] [timestamp] NULL,
[colNiceTime] [varchar](200) NULL,
[colDomain_User] [varchar](200) NULL,
[colMsg] [varchar](4000) NULL,
[colDebugLevel] [int] NULL,
[colDebugMsg] [varchar](4000) NULL,
[colPageName] [varchar](200) NULL,
[colClassName] [varchar](200) NULL,
[colMethodName] [varchar](200) NULL,
[colMethodNameGui] [varchar](4000) NULL,
[colRet] [int] NULL,
[colLineNumber] [int] NULL,
[colLineNumberGui] [int] NULL,
[colProcedureName] [varchar](200) NULL,
[colProcedureStep] [varchar](4000) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
-- This stored procedure does write to the log table
USE [db]
GO
/****** Object: StoredProcedure [dbo].[procUtils_AppDebug] Script Date: 02/12/2009 22:29:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[procUtils_AppDebug] (
@ret int = null OUT,
@msgIn varchar(4000) = null , -- the msg which the user has seen
@msgOut varchar(4000) = null OUT , -- the msg which the user has seen
@domain_user varchar(200) = null , -- the domain user echoing the message
@debugMsgIn varchar(4000) = null , -- the debug msg for internal use
@debugMsgOut varchar(4000) = null OUT, -- the debug msg for internal use
@pageName varchar(200) = null , -- the pageName originator of error
@className varchar(200) = null , -- the class Name orinator of error
@methodName varchar(200) = null , -- the methodName where the last error occured
@methodNameGui varchar(4000) = null , -- the methodNameOfTheGui where the last error occured
@lineNumber int = null , -- the line number of the line issueing the error
@lineNumberGui int = null, -- the line number of the line issueing the error
@procedureName varchar(200) = null , -- the procedureName currently envoked
@procedureStep varchar(4000) = null -- the steps of the procedure concatenated
)
AS
BEGIN -- proc start
SET NOCOUNT ON;
BEGIN TRY --begin try
declare @debugLevel int
select @debugLevel = Debug_Level from User_tb where Domain_Name = @domain_user
/*
select * from tbData_Debug order by 1 desc
delete from tbData_Debug
*/
insert into tbData_Debug ( colNiceTime , colDomain_User , colMsg , colDebugLevel ,
colDebugMsg , colPageName , colClassName , colMethodName , colMethodNameGui ,
colRet , colLineNumber , colLineNumberGui , colProcedureName , colProcedureStep) values (
dbo.funcGetNiceTime() , @domain_user , @msgIn , @debugLevel ,@debugMsgIn ,
@pageName , @className , @methodName ,@MethodNameGui , @ret ,
@lineNumber , @lineNumberGui , @procedureName , @procedureStep)
set @debugMsgOut = @debugMsgIn
set @msgOut = 'Action Registered'
set @ret = @@ERROR
return @ret
END TRY --end try
BEGIN CATCH
PRINT 'In CATCH block.
Error number: ' + CAST(ERROR_NUMBER() AS varchar(10)) + '
Error message: ' + ERROR_MESSAGE() + '
Error severity: ' + CAST(ERROR_SEVERITY() AS varchar(10)) + '
Error state: ' + CAST(ERROR_STATE() AS varchar(10)) + '
XACT_STATE: ' + CAST(XACT_STATE() AS varchar(10));
set @debugMsgOut = 'error at [procUtils_AppDebug]--- Error number: ' + CAST(ERROR_NUMBER() AS varchar(10)) + 'Error message: ' + ERROR_MESSAGE() + 'Error severity: ' +
CAST(ERROR_SEVERITY() AS varchar(10)) + 'Error state: ' + CAST(ERROR_STATE() AS varchar(10)) + 'XACT_STATE: ' + CAST(XACT_STATE() AS varchar(10))
set @msgIn= 'error while saving application error info into database'
insert into tbData_Debug ( colMsg ) values ( @msgIn )
set @debugMsgOut = @debugMsgIn + @debugMsgOut
set @msgOut = 'Action Registration failed'
set @ret = 1
END CATCH
return @ret
END --procedure end
/*
<procedureDocumentation>
<procedurename>procUtils_AppDebug<procedurename>
<procedureDescription> Records events from the Application Layer </procedureDescription>
<created>20090121</created>
<createdby>Yordan Georgiev</createdby>
<change>
<changewhen><changewhen>
<changeDescription></changeDescription>
<changedBy></changedBy>
</change>
<testUsage>
USE [db]
GO
DECLARE @return_value int,
@ret int,
@msgIn varchar(max),
@debugmsg varchar(4000)
SELECT @ret = 1
SELECT @msgIn = N'msg'
SELECT @debugmsg = N'before'
EXEC @return_value = [dbo].[procUtils_AppDebug]
@ret = @ret OUTPUT,
@msgIn = @msgIn OUTPUT,
@domain_user = N'domain_user',
@debugmsg = @debugmsg OUTPUT,
@methodName = N'methodName'
SELECT @ret as N'@ret',
@msgIn as N'@msgIn',
@debugmsg as N'@debugmsg'
SELECT 'Return Value' = @return_value
select * from tbData_Debug order by 1 desc
GO
</testUsage>
</procedureDocumentation>
*/ |