18 April,2017 by Jack Vamvas
Over the last few versions SQL Server has improved greatly on writing sql server error messages . A good example is writing to both SQL Server Error Log and the windows server event viewer.
There are a number of benefits in writing a SQL Server error to the windows event viewer.
To write a message to windows event viewer is impolemented by using the procedure : xp_logevent
An example is :
EXEC xp_logevent 60000, 'A message from MSSQL$TEST', informational
Which would generate an Windows Event Viewer entry in the Application Logs
Error: 60000 Severity: 10 State: 1 A message from MSSQL$TEST
Note: db_owner or sysadmin is required