You are on page 1of 15

Implementing Logging in Packages

10-May-2010
Write-
 Run-time events

 Custom messages

Log entries are a blend of status and result


messages
 Log providers can write log entries to
text files, SQL Server Profiler, SQL
Server, Windows Event Log, or XML
files
 Logs are associated with packages and are
configured at the package level. Each task
or container in a package can log
information to any package log. The tasks
and containers in a package can be
enabled for logging even if the package
itself is not
 You can select a level of logging that suits
your needs by specifying the events to log
and the information to log for each event.
Events Description
OnError Writes a log entry when an error occurs.
OnExecStatusChanged Writes a log entry when the execution status of the executable
changes.
OnInformation Writes a log entry during the validation and execution of an
executable to report information.
OnPostExecute Writes a log entry immediately after the executable has finished
running.
OnPostValidate Writes a log entry when the validation of the executable finishes.
OnPreExecute Writes a log entry immediately before the executable runs.
OnPreValidate Writes a log entry when the validation of the executable starts.
OnProgress Writes a log entry when measurable progress is made by the
executable.
OnQueryCancel Writes a log entry at any juncture in the task processing where it is
feasible to cancel execution.
OnTaskFailed Writes a log entry when a task fails.
OnVariableValueChange Writes a log entry when the value of a variable changes.
d
OnWarning Writes a log entry when a warning occurs.
PipelineComponentTimeFor each data flow component, writes a log entry for each phase of
validation and execution. The log entry specifies the processing time
for each phase.
Diagnostic Writes a log entry that provides diagnostic information.
The custom log entries are tailored to capture
useful information about a specific task in a
package.

E.g. for FTP Task:-


Events Description
FTPConnectingToServer Indicates that the task initiated a connection to the FTP server.

FTPOperation Reports the beginning of and the type of FTP operation that the task
performs.

More info
http://msdn.microsoft.com/en-
us/library/ms345174.aspx
 In Business Intelligence Development Studio, open
the Integration Services project that contains the
package you want.
 On the SSIS menu, click Logging.
 Select a log provider in the Provider type list, and
then click Add.
 In the Configuration column, select a connection manager or click
<New connection> to create a new connection manager of the
appropriate type for the log provider. Depending on the selected
provider, use one of the following connection managers:
 For Text files, use a File connection manager. For more information

 For SQL Server Profiler, use a File connection manager.

 For SQL Server, use an OLE DB connection manager. For more


information

 For Windows Event Log, do nothing. SSIS automatically creates the


log.

 For XML files, use a File connection manager.


 Repeat prior steps for each log to use in the package.
 Note: A package can use more than one log of each type.
 Optionally, select the package-level check box, select the logs to use
for package-level logging, and then click the Details tab.
 On the Details tab, select Events to log all log entries, or clear
Events to select individual events.
 Optionally, click Advanced to specify which information to log.
 Note: By default, all information is logged.
 On the Details tab, click Save. The Save As dialog box appears.
Locate the folder in which to save the logging configuration, type a file
name for the new log configuration, and then click Save.
 Click OK.
 To save the updated package, click Save Selected Items on the File
menu
 SELECT TOP 4 [id]
 ,[event]

id event
 ,[computer]
 ,[operator]
 ,[source]
 ,[sourceid]
 ,[executionid]
,[starttime]

1P acka

 ,[endtime]
 ,[datacode]
 ,[databytes]

2 O n P re
 ,[message]
 FROM [AdventureWorksDW].[dbo].[sysdtslog90]
 <dtslogs>
 <dtslog>
 <record>
 <event>OnPreValidate</event>
 <message>(null)</message>
 <computer>MBINB1</computer>
 <operator>MBINB1\DLundell</operator>
 <source>Lesson5</source>
 <sourceid>{02634DE5-FC26-4A03-8E63-
B8E6A2DE1417}</sourceid>
 <executionid>{41346301-9388-4BED-8882-
E3A41834944F}</executionid>
 <starttime>2/7/2006 11:59:14 PM</starttime>
 <endtime>2/7/2006 11:59:14 PM</endtime>
 <datacode>0</datacode>
 <databytes>0x</databytes>
 </record>
 #Fields:
event,computer,operator,source,sourceid,executionid,starttime,endtime,datacode,data
bytes,message
 User:PipelineExecutionTrees,MBINB1,MBINB1\DLundell,Extract Sample Currency Data,
{0208E748-D95A-4B2D-9112-DF67FC8EC663},{1D0AD994-198B-4FB9-9853-
A5AC2E36436E},2/6/2006 9:20:02 PM,2/6/2006 9:20:02 PM,0,0x,begin execution tree
0
 output "Flat File Source Output" (2)
 input "Lookup Input" (89)
 output "Lookup Output" (90)
 input "Lookup Input" (104)
 output "Lookup Output" (105)
 input "OLE DB Destination Input" (193)
 output "OLE DB Destination Error Output" (194)
 output "Lookup Error Output" (115)
 output "Lookup Error Output" (100)
 end execution tree 0
 begin execution tree 1
 output "Flat File Source Error Output" (3)
 end execution tree 1