on ‎2011 Sep 03 1:21 AM
How to log all database server errors like primary key violation error, column not found...into separate table on the same database with error message, user id, date and time. Is there any system event to log the errors?
Request clarification before answering.
I am not try it, but documentation describe such functionality:
sa_server_option system procedure
RequestLogFile The name of the file used to record request information. Specifying an empty string stops logging to the request log file. If request logging is enabled but the request log file was not specified or has been set to an empty string, the server logs requests to the Server Messages window. Any backslash characters in the path must be doubled as this is a SQL string. See -zo server option.
RequestLogging This call turns on logging of individual SQL statements sent to the database server for use in troubleshooting, in conjunction with the database server -zr and -zo options. Values can be combinations of the following, separated by either a plus sign (+), or a comma:
SQL enables logging of the following:
START DATABASE statements
STOP DATABASE statements
STOP ENGINE statements
Statement preparation and execution
EXECUTE IMMEDIATE statement
Option settings
COMMIT statements
ROLLBACK statements
PREPARE TO COMMIT operations
Connects and disconnects
Beginnings of transactions
DROP STATEMENT statements
Cursor explanations
Cursor open, close, and resume
Errors
May be it will logs all error into logging request file?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
RLL is a helpful feature, however as it does log all queries (when configured that way) - both successful and errornous - it may slow down the server performance. Therefore I would not recommend that as a "general error logging facility"...
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.