Sunday, February 26, 2012

Execute Process Task / Console Output

I'm just starting to find my way around SSIS, coming from SQL 2000 DTS, but I can't see a way of including a Win32 Console application's output into the logging process.

I've started playing around with SSIS Logs (OnTaskFailed etc..), but I can find no where to allow me to capture the output from a console app. In SQL 2000 DTS I could capture this by specifying an "output file" on the advanced tab of the job step definition. Is there something as straight forward as this in SSIS ?

I'd be grateful for a few pointers in the right direction.

One way would be to pipe the console output to a text file using appropriate calling syntax (myconsoleapp.exe >> myoutput.txt) , then read it in via a flat file source in a following step. of course the console output might need to be structured or parsed in a way that meets your needs for the further processing of the data, but it's one way.

Ken

|||

Thanks for the suggestions Ken. I see where you are going with it, but it's not that I need to further process the output from console app's, just log what they are producing. In fact, they do already produce a flat file which mirrors the console output it's just that I'd like the whole output from the package to be in one place .

Under SQL 2000, the job steps manage to allow you to easily capture both the SQL server messages for tasks along with the output from an application. It seems that the logging in 2005 is much more complete and varied, but makes this simple task more complex to accomplish. I'm sure it can be done, I just don't know the best avenue for investigation. My last thought was to try using the StandardOutputVariable property on the execute process task to capture the data to a string. I haven't persued this as it seemed a bit of a long shot, but that's where I'm at.

|||Using StandardOutputVariable is not a long shot. Its a sure bet. Just use that variable, and in a subsequent Script task, call Dts.Events.FireInformation() using that variable as the message parameter.

Provided your logging options are set on the script task for the event type ("OnInformation") and for whatever log provider you choose, you can have the data in one place.|||

jaegd wrote:

Using StandardOutputVariable is not a long shot. Its a sure bet. Just use that variable, and in a subsequent Script task, call Dts.Events.FireInformation() using that variable as the message parameter.

Provided your logging options are set on the script task for the event type ("OnInformation") and for whatever log provider you choose, you can have the data in one place.

I just tried setting the StandardOutputVariable and StandardErrorVariable properties, and now the task pops up a window each time the process is executed (it's in a loop), even though I've also set the WindowStyle property to Hidden. Is that to be expected?

No comments:

Post a Comment