Monday, March 26, 2012

Log file with header row only.

I have a parent a package which contains a bunch of Execute Package tasks. The parent package sets a variable which contains the directory for writing logs to. Each child is configured to write logs to a text file, and uses a connection manager for doing so. The connection manager uses an expression for setting the connection string, and in this expression the log directory varaible is used (e.g. @.[User::LogDir] + "\\FileName.log").

Now the problem is this, when I run the ETL, I'm getting 2 set of log files for each package: one log file is created in C:\ and the other in the correct dirctory. Each log in C:\ just contains a single header row, and the corresponding log file in the logging dir contains the log data (including the header row). Even though the filename is specified in an expression, a value for the connection string appears in the properties for the connection manager ("\Filename" which probably where the C:\ log files are coming from). I can't seem to remove this value, and I don't want to hard-code it to a fixed path. I've also set DelayValidation to True, with no luck. I feel I must be missing something obvious, any suggestions? Thanks!

Fraser,

Interesting problem. You might get something from reading through this:

Logging With SSIS: Beware of Parent Package Variable configuration!

I've made a few comments here:

SSIS: Package spin-up order of events

(http://blogs.conchango.com/jamiethomson/archive/2006/10/08/SSIS_3A00_-Package-spin_2D00_up-order-of-events.aspx)

-Jamie

|||

Thanks for the info Jamie. I'm going to give this work-around a try: create a new parent package which is nothing more than a wrapper - it has a script task that creates an environment variable (set to the contents of log directory variable), and then uses an execute package task to start the real parent package. Then each package including the real parent package can pull this directory from the environment variable rather than from a parent variable. This way setting up the environment variable is hidden from the end user and all configuration will be localized to a single config file.

No comments:

Post a Comment