- I am using SQL server 2008 R2.
- I have a scheduled job that executes an SSIS Package - running in SQL Agent.
- I want to log messages that happen in the scheduled job.
- I want to log messages from Script Component or Script Task.
- I do not want to log ONLY errors, I want to log success messages such as "Processed X records".
- I do not want to build custom tables or anything.
- Ideally, I want to see these messages in the Job History log
Asked
Active
Viewed 5,627 times
3

Simcha Khabinsky
- 1,970
- 2
- 19
- 34
1 Answers
4
You can send messages directly to the Job History Log. It will show up as follows in the Job history log:
For Script Tasks use the following code:
Dts.Events.FireWarning(0, "Message header", "Message Body", String.Empty, 0)
For Script Component use the following code:
Dim myMetadata As IDTSComponentMetaData100
myMetadata = Me.ComponentMetaData
myMetadata.FireWarning(0, "Message Header", "Message Body", "", 0)
You will need to enable "Include step output in history (see below)
- Right-Click on Job >> Steps >> Edit >> Properties >> Advanced >> Check "Include step output in history"
You will need to enable Warning Messages for the SSIS package (see below)
- Right-Click on Job >> Steps >> Edit >> Properties >> Command Line Add "W" to /REPORTING
Enabling "Include step output in history":
Enabling Warning Messages:

Simcha Khabinsky
- 1,970
- 2
- 19
- 34