[dba-SQLServer] Error logging

jwcolby jwcolby at colbyconsulting.com
Wed Oct 7 10:19:24 CDT 2009


I have reached the point where I need to start logging processes (SQL Statements) and any errors 
encountered in my stored procedures.

I typically run stored procedures where I will create a field in a table, create an index to 
facilitate updating that field, update the field, then drop the index.  There can be many processes 
in that stored procedure, 4 or 5 or more.  I want to log after each step.

My concept is to build a ProcessLog table where I log the process itself.  This table would hold 
things like ProcName, ProcMemo, ProcDate, ErrInt, ErrStr.

It seems logical to create a stored procedure to call after each process completes or in the Catch 
statement in order to log errors.  This stored procedure would accept parameters and actually write 
to the log table.

The process steps usually take a long time, often minutes or even tens of minutes, thus the time to 
log each one is not an issue.

I assume that many of you do something similar so I am asking for guidance or advice for how you 
handle this.
-- 
John W. Colby
www.ColbyConsulting.com



More information about the dba-SQLServer mailing list