November 17, 2008 at 4:06 am
Hi all,
The situation is like that, I am running some deleting jobs and want to track
errors while deleting if any error occurs i need it to go into Eventlog of the system.
Is is ok to log event but the problem is that I need my own event id need to be
inserted into the eventlog.
Please provide help to achieve this.
Let me know if you need additional info.
Thanks in advance.
Mohammad Irfan
http://matespoint.blogspot.com
http://www.irfit.com
November 17, 2008 at 6:16 am
You can create you're own custom error using sp_addmessage. If you use the WITH LOG option the error is written to the SQL errorlog and the application log.
USE master
GO
EXEC sp_addmessage @msgnum=50001,
@severity =16,
@msgtext = N'Error during delete.',
@with_log = 'TRUE';
GO
[font="Verdana"]Markus Bohse[/font]
November 17, 2008 at 6:34 am
Thanks Marks,
I am facing the problem as this 5001 is written into message not in the eventid,
is this 5001 will be written as event id in your case?
Today I am leaving now, i will try it tomorrow.
Mohammad Irfan
http://matespoint.blogspot.com
http://www.irfit.com
November 17, 2008 at 7:03 am
while deleting if any error occurs i need it to go into Eventlog of the system
Try RAISERROR WITH LOG
November 17, 2008 at 9:39 pm
Thanks all for your answers,
I am able to log these message into eventlog, but my requirement is that I need my custom eventid and may be custom datasource,
Is this possible?
I know there will be a way around..
Need to investigate, learn ..
Thanks
Mohammad Irfan
http://matespoint.blogspot.com
http://www.irfit.com
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply