A blog about SQL Server, SSIS, C# and whatever else I happen to be dealing with in my professional life.

Find ramblings

Sunday, January 25, 2009

Log dagnabit!

The Script Control Flow task is awesome, it really helps SSIS handle
situations that aren't covered by out of the box functionality but
aren't generic enough to warrant a custom task. Some features, in
2005 at least, just don't seem to be as intuitive as one might think.
Events and logging come to mind---not the built in stuff, that's
pretty straight forward but take for example, you want to call this
code.
Dts.Log(errorMessage, 0, Nothing)
where errorMessage is a string you have defined elsewhere. The
package runs and you will look through the rows logged to SQL Server
and nothing. Well sonofagun, why didn't it log? My assumption,
because I don't feel like digging through the documentation, is that
the task correctly raises a log event from the script task but there
is no listener for it and so it drifts off into the ether.

And that
assumption seems to hold water because if I dig through SSS,
Logging... drill down to my actual script task container and then
override the package level logging (greyed out checkmark, to no check,
to a full black check, grab my log provider) what suddenly appears but
an option for ScriptTaskLogEntry. Check _that_ and rerun the package
and now the items logged via Dts.Log will be recorded by the log
provider.

Pictures of the above are available at http://billfellows.blogspot.com/2009/12/log-dagnabit-2.html

No comments: