Blog Post

Sending SSIS Errors to the Windows Event Log

,

 In a previous post I explained how to trap for errors in your Script Task and Components and send the information to the SSIS Log (link).  A good friend of mine and system engineer extraordinaire Eugene L. (last name withheld to protect the guilty 🙂 ) suggested that I also push these errors to the windows event log.  We have HP OpenView which is monitored by our operations group, which will enable us to setup alerts through them as well.  This sounded simple enough and after about 5 min of research it turns out it is simple.  All you need to do is add an additional class and one additional object.

First you need to add, using System.Diagnostics.  This provides the hook to the classes that will enable you to push your error to the Windows Event Log.  Now create the object to interact with it:

EventLog evLog = new EventLog("Application", System.Environment.MachineName, "ImprovedTidalExtract");

I set up the header for the log.  This is an "application", being run on "System.Environment.MachineName", and the application name is "ImprovedTidalExtract".

Now I have to provide the detail information, that is the actual error.  Within the Catch block, I add an additional line.

img1

 

How will this look within the event log?  Like this:

img2

 

 The detailed entry I created with the above try/catch looks like this:

img3

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating