Error Logging to Event Viewer

  • Hi All,

    Is it possible to log error message to windows Event Viewer through T-Sql Statement?

    Regards,

  • Use RAISERROR command. There is an option for LOG.

    Per BOL:

    OPTION LOG

    Logs the error in the error log and the application log for the instance of the Microsoft SQL Server Database Engine. Errors logged in the error log are currently limited to a maximum of 440 bytes. Only a member of the sysadmin fixed server role or a user with ALTER TRACE permissions can specify WITH LOG

    Another way is to write a .NET CLR Procedure/Function/etc to call when error occurs to log the message to the Event viewer logs.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply