Log Method
Collapse the table of content
Expand the table of content

LogProviderBase.Log Method

Called when a runtime event occurs during package execution.

Namespace:  Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

public virtual void Log(
	string logEntryName,
	string computerName,
	string operatorName,
	string sourceName,
	string sourceID,
	string executionID,
	string messageText,
	DateTime startTime,
	DateTime endTime,
	int dataCode,
	byte[] dataBytes
)

Parameters

logEntryName
Type: System.String
The name of the event.
computerName
Type: System.String
The name of the computer on which the package is executing.
operatorName
Type: System.String
The user account executing the package.
sourceName
Type: System.String
The name of the object raising the event.
sourceID
Type: System.String
The ID of the object raising the event.
executionID
Type: System.String
The execution ID of the executing package.
messageText
Type: System.String
The text message of the event.
startTime
Type: System.DateTime
The start time of the action causing this event.
endTime
Type: System.DateTime
The end time of the action causing this event.
dataCode
Type: System.Int32
Numeric data field.
dataBytes
Type: System.Byte[]
BLOB data field.

This method is called when an event from the IDTSEvents or IDTSInfoEvents interfaces occur.

You use this method to write log entries as a package executes.

The parameters to this method provide information about when the event began, the object that raised the event, and so on.

The Log method is called each time an object in the package raises an event by calling a FireEvent method on one of the event interfaces. There are multiple event interfaces, each of which may contain a subset of the events defined in the IDTSEvents interface. Included in this interface is the FireCustomEvent method, which is the event that objects with custom events use to raise the event.

The following code example implements the Log method, and writes the events to the stream that was opened in the previous section.

public override void Log(string logEntryName, string computerName, string operatorName, string sourceName, string sourceID, string executionID, string messageText, DateTime startTime, DateTime endTime, int dataCode, byte[] dataBytes)
{
    sw.Write(logEntryName + ",");
    sw.Write(computerName + ",");
    sw.Write(operatorName + ",");
    sw.Write(sourceName + ",");
    sw.Write(sourceID + ",");
    sw.Write(messageText + ",");
    sw.Write(dataBytes + ",");
    sw.WriteLine("");
}

Community Additions

ADD
Show:
© 2016 Microsoft