Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Basic Logging

Author  Topic 

jonjsilver2
Starting Member

14 Posts

Posted - 2011-01-11 : 12:20:03
What do people use for basic stored procedure logging

We have a system with lots of stored procedures
One guy put some logging by writing to an error table, but don't
these get rolled back on error (and rollback)?

I wrote a quit little procedure but it uses ole to write to a file, but I think thats a security risk.

Are there any good standard logging functions?
thanks,
jon

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-01-11 : 12:32:21
Whether or not the logging part gets rolled back would depend upon how the developer coded the transaction.

There isn't much you can do in SQL 2000, so logging to a table would be a good solution.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jonjsilver2
Starting Member

14 Posts

Posted - 2011-01-13 : 16:25:59
We have lots and lots of stored procedures.
logging to a table is not very nice when there is not a lot of architecture in place.

We'd have to pass logging strings around all over the place. In most cases only the top most level stored procedure should issue the commit,
so any logging some by called stored procedures or functions would need to be saved in the event of a rollback.

A Calls -> B calls -> C
calls -> d

it would be nice if logging is outside of rollbacks and commits
Seems like there should be some standard features or common packages
available. Maybe some that limit file i/o so that we wouldn't have
as much security risks

thanks.
jon
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-01-13 : 16:28:23
What I'm saying is that the logging portion would not be part of the transaction assuming it gets developed right.

There is no standard feature for what you want.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jonjsilver2
Starting Member

14 Posts

Posted - 2011-01-13 : 16:52:29

How do you mean?
If we're logging to a table, is that not by definition part of a transaction? - and gets all of the associated overhead?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-01-13 : 16:53:31
Yes it is part of a transaction as it would be an implicit transaction, but it would not be part of any other transaction that's inside the stored procedure if the code is written properly.

All DML is in a transaction, regardless if you specify it or not.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -