If i want to save information/log when some event accour in a SISS package, which way is the better?
- use the SSIS logging – set provider type to SQL Server and selecting the events to be stored in SQL Server.
- use the Event Handlers on the package/task and use an execute sql task to save information to a table in SQL Server.
Better is subjective. Only by knowing your requirements can you determine whether one is better than the other.
SSIS Logging
This is an easy, out of the box, mechanism for tracking package progress. The table already exists in SQL Server and is copied down to the target catalog if you’re logging to something besides msdb (yes please). If the information it records for the events you care about match your requirements, then it’s a no-brainer choice.
Event Handlers
The event handler route provides more flexibility on the information that is recorded. In fact, if you have needs, you can have a full blown work flow within an event handler (I highly recommend against that approach) with an event handler. The downside to using Event Handlers to record stuff is you’ll need to set it up everywhere. Copy & Paste is less flaky in 2012 but any change to your logging would have to be perpetuated throughout all your packages.
For the longest time, we used a “both” approach for recording package information. Our Logging went to SQL Server and we recorded OnError, OnTaskFailed, OnWarning, OnInformation, OnPreExecute, OnPostExecute. This provided us with more information than we generally needed but it was easily accessible so we kept it.
We also had an OnTaskFailed event wired up to send email to an on-call pager detailing information about the failure. This worked fine when we had 3 packages running daily. When we got to the point of having hundreds of packages running… Ick.