Logging Errors from SSIS Script Task

  • 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.

  • 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

  • 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

  • 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

  • Thank you, da-zero. That worked perfectly!

  • 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