Showing posts with label task. Show all posts
Showing posts with label task. Show all posts

Saturday, February 25, 2012

Capturing Error Information

Question #1
Is there a way to get a handle on the context of an error within an Error Handler for a task, containter, or package?

ie:
I am looking to log(Custom logging using script task not Log provider) error information, code, stack, etc. from a task or container that fails due to an unhandled exception. When the exception is handled using OnError event handler, I don't get the context of the task or the container.

Question #2
Is there a reason why Pre and post execute events for a package get executed several times? I have a script task that logs pre/post package information into our db, however, everytime I run the package in debug mode, it logs 5 - 10 messages into the DB for pre/post events. Don't these events ONLY fire once per package?

for #1 see
http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=86691

for #2 see
http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=86608|||Thank you for the reply. The #2 is answered, however, for #1, what if I don't have logging configured. In this scenario the exception will be lost and logged to the DB.

Is there a way, I can pick up the context of the error from OnError Event handler? or do I have to look at the Db for an error?|||

N.S. wrote:

Thank you for the reply. The #2 is answered, however, for #1, what if I don't have logging configured. In this scenario the exception will be lost and logged to the DB.

Is there a way, I can pick up the context of the error from OnError Event handler? or do I have to look at the Db for an error?

What exactly do you mean by the "context of the error". The OnError event handler provides the error message and information about the container that raised the error so it s obviously something other than those.

-Jamie|||

By Context of the error, I mean the actual error message and error code for the container that raised OnError event.

Within OnError event handler, if I add a script task, how can I retrieve the actual error message and error code? Are there System variables that I can use within the script to get that information? Thanks.

Sunday, February 19, 2012

Capture date and timestamp of a file?

Hi,

I am pulling files from the FTP site using the FTP task. I want to also capture the date and timestamp of each of these files so that I can insert the values into a database and track when are these files get created normally on the FTP server.

Any ideas?

Thanks in advance for your help.

$wapnil

Doesn't the transfer of files from the FTP server preserve the date and time? You could inspect that with a custom script.|||

No the transfer of files do not preserve the date and time. When i download the files all the files show the same date and timestamp.

Can the FTP task be configured to preserve the date and time?

Thanks!

$wapnil

|||

spattewar wrote:

No the transfer of files do not preserve the date and time. When i download the files all the files show the same date and timestamp.

Can the FTP task be configured to preserve the date and time?

Thanks!

$wapnil

Well.... You can write a custom script to perhaps issue an 'ls' command inside the FTP session. Remember, FTP isn't designed for file interrogation, it's designed to transport files.|||

Thanks.

I am using a ForEach loop container which iterates through a list of file names to be downloaded. In this container I have an FTP task that uses an FTP connection manger to connect and download the file name passed to it by the container. If the FTP is successful then I update the database using an Execute SQL task to tell that the file has been downloaded.

Where should I keep the custom script so that it runs inside the FTP session? Also can I use the File System task in some way? I am pretty new to his and hence may be asking very rudimentary questions..please be patient.

Thanks agains for your time.

$wapnil

|||The script would be your FTP session. It would replace your FTP task.|||

I will try this out and will let you know in case there are any problems.

Thanks.

$wapnil