June 22, 2010 at 8:07 am
I have a Script Task in SSIS 2005. I want this task to log any errors that may occur but I do not want to fail the task.
My reasoning is that this system has a ForEach container around the Script Task. The script task is connecting to multiple servers and querying data. If there is a problem connecting to a server, I do not want the task to fail. I want to log the error and continue processing the other servers.
I have a try/catch block currently in my code. This will cause the script to report no failure at all if there is a problem.
I've also tried using the Dts.Log method, but I'm not entirely sure how to use it or if it's the correct approach.
June 22, 2010 at 8:16 am
Can't you just perform an "INSERT INTO <log table>" inside your catch block? That's how I typically log script errors (and script execution for that matter).
--J
June 22, 2010 at 8:26 am
Robert Biddle (6/22/2010)
I have a Script Task in SSIS 2005. I want this task to log any errors that may occur but I do not want to fail the task.My reasoning is that this system has a ForEach container around the Script Task. The script task is connecting to multiple servers and querying data. If there is a problem connecting to a server, I do not want the task to fail. I want to log the error and continue processing the other servers.
I have a try/catch block currently in my code. This will cause the script to report no failure at all if there is a problem.
I've also tried using the Dts.Log method, but I'm not entirely sure how to use it or if it's the correct approach.
The Dts.Log method is really easy. You just have to activate logging on your package:
* right-click on control flow. Choose Logging.
* configure a log provider.
* select the checkbox at your script task (at the left of the window)
* in the details pane, make sure ScriptTaskLogEntry is selected.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
June 22, 2010 at 8:28 am
da-zero (6/22/2010)
Robert Biddle (6/22/2010)
I have a Script Task in SSIS 2005. I want this task to log any errors that may occur but I do not want to fail the task.My reasoning is that this system has a ForEach container around the Script Task. The script task is connecting to multiple servers and querying data. If there is a problem connecting to a server, I do not want the task to fail. I want to log the error and continue processing the other servers.
I have a try/catch block currently in my code. This will cause the script to report no failure at all if there is a problem.
I've also tried using the Dts.Log method, but I'm not entirely sure how to use it or if it's the correct approach.
The Dts.Log method is really easy. You just have to activate logging on your package:
* right-click on control flow. Choose Logging.
* configure a log provider.
* select the checkbox at your script task (at the left of the window)
* in the details pane, make sure ScriptTaskLogEntry is selected.
Dts.Log is probably easier and more consistant than my previous suggestion.
--J
June 22, 2010 at 8:33 am
Thank you, da-zero. That worked perfectly!
June 23, 2010 at 12:15 am
I'm glad to help!
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply