Script Task - Dts.Log() method isn''t working

  • I've read on a few sites and in the BOL help that you can use the Dts.Log() method from the Script Task to write messages out to the logging that is enabled for a package.  It isn't working in my packages.

    So I created a new package and it has one task, a Script Task.  The code for the Script Task:

    Dim bt(0) As Byte

    Dts.Log(

    "message from script", 0, bt)

    Dts.TaskResult = Dts.Results.Success

    I then enable logging with the SSIS Log Provider for Text Files and set it up to log all the possible events - OnError, OnInformation, etc.  I run the package and it runs fine.  I check the log and it's filled with the logging info, EXCEPT my message from the script is not there.  I tried adding log providers for Sql Server and Windows Event Log with the same results.  The Dts.Log method is definitely executing without error, but I can't find where it's writing the message to.

     

  • This was removed by the editor as SPAM

  • In IS logging, you have to turn on everything. Go into the advanced tab and turn on the custom event for the script task.

    In the Containers window of the Configure SSIS Logs dialog, select the script task. Then select the detail tab on the right side of the dialog. Put a check in the ScriptTaskLogEntry checkbox.

    That should do the trick.

    HTH,

    K

  • Thanks for the trick. It works fine man

    Sk

  • I got it working today.  It required a few extra clicks...on the logging dialog but essentially worked as Kirk described. I used a user variable for the DateLastChanged and the

    System :: PackageName for the log message.

    Extra spaces arround double colons because the combination of colon followed by capital p resulted in another emoticon.

    IanO

  • Mine is not working either, I checked the ScriptTaskLogEntry option.

  • You have to go step by step.

    Right click any where in the package

    SELECT Logging.

    In the Left Pane Expand till you reaches the perticuler "Script task" where the Dts.Log entered

    Click TWICE to make a SELECT on the task

    In the right pane you will see the PROVIDERS and LOGS for the perticuler package.

    SELECT the one where you need the LOG entry.

    Click DETAILS tab

    Check 'ScriptTaskLogEntry'

    thanks

    akkua

  • Just a note, in case anyone also had the additional minor problem I did ...

    You need to check the properties on the script task, specifically "Logging" to make sure that it is set to "Enable" and not "Use Parent Settings". In the later case, the ScriptTaskLogEntry option does not even show up (since the parent object, in all likelihood, is NOT another script task and therefore does not have that option). Once this inheritance is broken, the needed option does appear in the Details section of the Logging configuration settings window.

    Happy Scripting!! :hehe:

  • The Dts.Log method seems to be working in main package script task. However it does not seem to work within the script task within an event (executes without error). The package does not list the script task within the event and I have logging = Enabled for the script task.

    Any update on this shall be appreciated.

  • Hi

    This is obviously a bit late(!), but one thing I have noticed when messing around with DTS.Log is that in order to test script task logging properly you have to run the whole package, disabling any tasks that you don't want to run.

    If you only run the script task on its own, logging won't work

  • What if I don't want to log to a file, but instead just have the output go into the text you see in Job History, as well as seeing it in the Output Window within BIDS ? I really can't use the log to a physical file methodology because then I wouldn't have access to the file, given the server configuration.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • no easy way to log the SSIS logging to sql server agent log.

    one way would be to change the job to execute a cmd file containing 2 steps

    step 1 - the dtexec command line - writting the contents of the DTEXEC output to a file, and having the ssis package logging to another file.

    step 2 - cat/print/type the contents of both files to standard output. it will then be displayed on the agent log.

    not using sql server agent logging

    another solution is to output the logs to a Sql server table and get the DBA's to give you select to that table.

    - one issue with this is that by default the ssislog table truncates the message text to 4k chars if not mistaken.

    yet another solution, and this is quite common is that you do output to files and you get read permission to the folder containing the logs.

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply