Logging in the Script Task

업데이트: 2006년 4월 14일

The use of logging in Integration Services packages lets you record detailed information about execution progress, results, and problems by recording predefined events or user-defined messages for later analysis. The Script task can use the Log method of the Dts object to log user-defined data. If logging is enabled, and the ScriptTaskLogEntry event is selected for logging on the Details tab of the Configure SSIS Logs dialog box, a single call to the Log method stores the event information in all the log providers configured for the task.

[!참고] Although you can perform logging directly from your Script task, you may want to consider implementing events rather than logging. When using events, not only can you enable the logging of event messages, but you can respond to the event with default or user-defined event handlers.

For more information about logging, see 패키지 실행 로깅.

Logging Example

The following example demonstrates logging from the Script task by logging a value that represents the number of rows processed.

Public Sub Main()

    Dim rowsProcessed As Integer = 100
    Dim emptyBytes(0) As Byte

    Try
        Dts.Log("Rows processed: " & rowsProcessed.ToString, _
            0, _
            emptyBytes)
        Dts.TaskResult = Dts.Results.Success
    Catch ex As Exception
        'An error occurred.
        Dts.Events.FireError(0, "Script Task Example", _
            ex.Message & ControlChars.CrLf & ex.StackTrace, _
            String.Empty, 0)
        Dts.TaskResult = Dts.Results.Failure
    End Try

End Sub

Change History

Release History

2006년 4월 14일

New content:
  • Noted suggestion that events may provide more benefits than logging.

참고 항목

관련 자료

Integration Services 로그 공급자
패키지에서 로깅 구현

도움말 및 정보

SQL Server 2005 지원 받기