- Text File Logging
- SQL Server Profiler
- SQL Server
- Windows Event Log
- XML File
Choose the Log provider, In our case we are using Text File Logging
Create Connection for Log file as shown below
Choose the containers , Tasks for which you want to enable logging
Choose the events for each of the task or container you want to save in log file. For more details about events visit the link that I provided in Solution section
If we run our package now, it is going to create a log file on desktop for us with the name MylogFile.txt. But our goal is not to generate a log file like that. We want to create a log file in PackageLogFiles Folder with PackageName and Datetime.
Create a variable VarLogFolderPath and save the path of folder where you want to save the log files.
@[User::VarLogFolderPath]+"\\"+ @[System::PackageName]+"_"+Replace(Replace(Replace(SUBSTRING((DT_WSTR,50)(GETDATE()),1,16),"-","")," ","_"),":","")+".log"
As you have noticed that I did not save the time till seconds level. If I will do that , SSIS will create multiple log files , couple of them while validation. To avoid that I am creating log file with YYYYMMDD_HHMM.
Final Output :
Let's run our SSIS Package couple of times and check the Log File Folder.Wow!! the log files are created for each execution of SSIS Package.