This post will show you how to log from the script task.
While logging from inbuilt log system this method helps you to log the exact details of the event in the script task.
using System;
using System.Data;
using System.Math;
using Microsoft.SqlServer.Dts.Runtime;
public class ScriptMain
{
public void Main()
{
//
int rowsProcessed = 100;
byte[] emptyBytes = new byte[0];
try
{
Dts.Log(“Rows processed: “+rowsProcessed.ToString, 0, emptyBytes);
Dts.TaskResult = Dts.Results.Success;
}
catch(Exception ex)
{
//An error occurred.
Dts.Events.FireError(0, “Script Task Example”, ex.Message+ControlChars.CrLf+ex.StackTrace, String.Empty, 0);
Dts.TaskResult = Dts.Results.Failure;
}
}
Filed under: SSIS, integration services | Tagged: integration services log, logging ssis, script task, script task log, ssis log


