The Write log activity creates a log entry at a certain place in the package during package execution.
While packages already output an extensive log of each execution, sometimes you need to write some additional information, and this activity allows you just that.
|Table of contents|
The Write log activity allows you to output information to the package log file to provide you with further information about the execution. These can be anything from the number of records masked after a table is finished, information about which activity is starting or ending, etc. It is recommended to use custom code for more complex log messages to make the package more readable. All log messages have to be a string.
Apart from logging a message, this activity can also report an exception. A new exception can be added by changing the Fault property and it has to be of the System.Exception type. In this case, exception is reported after the log message. The severity level of the log message can also be changed, but the log message will only be written if the severity level is the same or lower than the severity level set in the App.config file. The default severity level of both the Write log activity and the package are set to INFO, so the log messages will be shown.
Note that every log entry in the package log file writes information about the time the message was written, as well as the duration of the package execution during that time, so you don't need to repeat that information in your own log messages. Also, package steps automatically log information about the start or end of their own execution, including the time and duration or the package execution at the time.
In this example, two Write log activities are placed to provide further information to the user. One after the Steps before masking step, which disables triggers and constraints that would disable the masking process in some capacity, to inform the user who monitors package executions of what is happening. The second Write log activity is placed at the end of the package, after the Steps after masking step, again to provide further information to the user who monitors package executions.
Figure 1: Writing additional information to the log file
|Property group||Property name||Description||Example|
|Input properties||Fault||Exception to write to log entry.||
|LogSeverity||Determinates the severty of the log entry.||
|Message||Message of the log entry.||
|Misc||DisplayName||Display name of the activity in the workflow.||