How to create Error Log inside the SSIS Package ??

Posted on 2011-04-24
Last Modified: 2012-05-11
I am working on SQL 2008 - SSIS Package. I am executing the package from C# Code. Its simple Flat File ( .csv) to SQL Table.

From the c# code, i get execution result as "SUCCESS". But inside the package Transactions have not taken, So values are not actually exported.

I need to debug it, by reading the log file.

How to create Error Log or Log File inside the Package. ??
Question by:chokka
    LVL 26

    Expert Comment

    if you are calling the ssis package from the command line you may use the -L option to get the log as explained in this link

    also this link will be very helpful for you if you want to log the ssis package activities within package..
    LVL 2

    Accepted Solution

    If you want to enable logging on a package this covers how you can implement that in your packages with all the available options.

    Otherwise, you can use a data viewer to see what values are being passed as a means to debug. I do this often and it is easy enough to implement. Just right click the transformations and select data viewer and click add. Your other option is to log the failed rows by taking the error path on the data flow (the red connector) and direct it to a file for output.
    LVL 21

    Expert Comment

    by:Alpesh Patel
    There are different events. Using those events you can Create a  Log.

    There are events like Error, Warning, PreExecute ,Prost Execute is there. SAve the each row for step.

    Author Comment

    tigin44 : Thank you for comment. I mentioned on my Post clearly - I am calling SSIS Package from C# Source Code.

    Below is the Source Code for invoking the SSIS Package !!!
    DTSExecResult pkgResults = new DTSExecResult();
                string strSourceConn = @"C:\SourceFile\File1.csv";
                string pkgLocation = @"C:\SSIS\SSIS\SSIS\Package.dtsx";
                Package pkg;
                Microsoft.SqlServer.Dts.Runtime.Application app;
                app = new Microsoft.SqlServer.Dts.Runtime.Application();
                pkg = app.LoadPackage(pkgLocation, null);
                pkg.Variables["sSorceFileName"].Value = strSourceConn;
                pkgResults = pkg.Execute();
            catch (Exception ex)

    Open in new window


    Author Comment

    I kept a Script Task which is connected to DataFlow.

    Inside the Script Task, I wrote


    Message Box Pops up and shows - False

    So, Values which i am passing from C# Source Code is not reaching the Data Flow Task
    LVL 2

    Expert Comment

    Can I ask one quick question? Is the variable in the package suppose to be "sSorceFileName"? or is it misspelled in both places?

    Author Comment

    SQL Sergent Mike - It is supposed to be sSorceFileName

    and we are following the same name every where !!!

    Reason behind sSorceFileName was, one of our developer written the variable name every where ..! And i have to follow footsteps of my existing developer !!!

    Author Closing Comment

    Thank you

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
    Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now