Saran Jawaban How to Send a message to SSIS Log?

  • 09 Maret 2012 3:39
     
     

    Hi All,

    I have a SSIS package which is having 3 levels of data loading to SQL Tables.I want to send a Custom message to SSIS Package log file after completetion of data loading to each level. How can we do this, Could you please suggest me on this

    Thanks in Advance.


    Thanks & Regards, Anil

Semua Balasan

  • 09 Maret 2012 4:10
     
     

    Anil,

    Can you please give us more details? like what message you want to sent to the log file with some example.

    Regards,

    Eshwar.

  • 09 Maret 2012 4:25
     
     

    Hi Eshwar,

    i want to send a message to Log as '1st level of Data loading has done successfully'.

    likes wise '2nd level of Data loading has done successfully'

    '3rd level of Data loading has done successfully'


    Thanks & Regards, Anil

  • 09 Maret 2012 6:54
     
     Saran Jawaban
    You can put event handlers on the PostExecute event of those "levels". In those event handler you put an Execute SQL Task that will do an INSERT statemenet in the logging table.

    MCTS, MCITP - Please mark posts as answered where appropriate.
    Answer #1: Have you tried turning it off and on again?
    Answer #2: It depends...


  • 09 Maret 2012 8:36
    Moderator
     
     Saran Jawaban

    You could use a Script Task to log events:
    http://microsoft-ssis.blogspot.com/2011/02/script-task-and-component-logging.html

    Just one line of code... You can fire forexample an information or warning message, but you still have to include these kind of messages in your logging.


    Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com | Twitter

  • 13 Maret 2012 9:47
     
     

    Hi,

    I have Created a Package which is having a Script task.This task is having the below code.
             try
                {
                    Dts.Log("Rows processed: " + rowsProcessed.ToString(), 0, emptyBytes);
                    Dts.TaskResult = (int)ScriptResults.Success;
                }
                catch (Exception ex)
                {
                    //An error occurred.
                    Dts.Events.FireError(0, "Script Task Example", ex.Message + "\r" + ex.StackTrace, String.Empty, 0);

                    Dts.TaskResult = (int)ScriptResults.Success;
                }
    I have Checked in ScriptTaskLogEntry event in the Details tab for this script task and Loggig propety of Script task is "Enabled".
    But still iam not getting this Custom message in the Log file.
    Here Logging configuration is for Text file.
    Could you please suggest me any thing required to do other than these steps.


    Thanks & Regards, Anil

  • 13 Maret 2012 9:55
     
     
    The code seems correct to me.
    So other information did get logged, but the log message for the script task didn't?
    What if you also add the DTS.Log method to the catch?

    MCTS, MCITP - Please mark posts as answered where appropriate.

  • 13 Maret 2012 12:43
     
     

    Hi

    Yes.Other Events getting Logged Except Custom Log for the Script task.

    Tried with by adding Dts.Log() statement in Catch Block. But still this message didn't logged.


    Thanks & Regards, Anil

  • 27 Maret 2012 21:13
    Moderator
     
     

    Hi Anil,

    Did you select the log file for the Script Task container? If you have it selected at the Package level, it is not necessarily also selected at the Script Task level (under Providers and Logs tab).

    Thanks,

    Cathy Miller