xp_logevent <error_number>, <message>[, <type>]
<error_number>
是用户分配的错误号。必须等于或大于 50000。
<message>
是在事件查看器的说明字段中显示的消息的文本。消息最长为 255 个字节。消息用引号引起来。
<type>
说明事件的紧急程度。值可以是 informational、warning 和 error。缺省值为 informational。值用引号引起来。
在 Windows 事件日志中记录信息性事件,编号为 55555。事件详细信息窗口中的说明文本为“Email message deleted”:
xp_logevent 55555, 'Email message deleted.'
在 Windows 事件日志中记录错误事件,编号为 66666。事件详细信息窗口中的说明文本为“DLL not found”:
xp_logevent 66666, 'DLL not found.', 'error'