SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Logging Errors from SSIS Script Task


Logging Errors from SSIS Script Task

Author
Message
Robert Biddle
Robert Biddle
SSChasing Mays
SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)

Group: General Forum Members
Points: 604 Visits: 355
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.
jvanderberg
jvanderberg
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6286 Visits: 746
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
Koen Verbeeck
Koen Verbeeck
SSC Guru
SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)

Group: General Forum Members
Points: 233829 Visits: 13374
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.


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
jvanderberg
jvanderberg
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6286 Visits: 746
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
Robert Biddle
Robert Biddle
SSChasing Mays
SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)SSChasing Mays (604 reputation)

Group: General Forum Members
Points: 604 Visits: 355
Thank you, da-zero. That worked perfectly!
Koen Verbeeck
Koen Verbeeck
SSC Guru
SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)SSC Guru (233K reputation)

Group: General Forum Members
Points: 233829 Visits: 13374
I'm glad to help!


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search