At times I like to capture certain errors and events that occur in a Script Task in an SSIS package, and include them in the package logging. In order to make this happen simply include the appropriate statements in your Script Task and turn on some custom logging within the package logging configuration.
Add a Dts.Log statments to your vb Script Task. For example:
Dim dataBytes(0) As Byte Dts.Log("Did not find expected database", 0, dataBytes)
In order for this message to be included in the [sysssislog] table simply right click on the package Control Flow surface, and select Logging. Within the Containers window, drill down to your Script Task.
Check the box beside the Script Task until it has a black check mark, instead of a greyed out check mark. In the Providers and Logs tab select the log you want to write to.
On the Details tab select the Events you wish to log, and be sure to select the ScriptTaskLogEntry.
Click OK and you’re done. Your custom messages will be included in the package logs.