Submitted byCategory
Review Cycle
.
Public
Joachim Mutter/sysarc
on 06/06/2008 at 02:18 PM
SSiS\Code

ErrorWriter, Error Logging OnError event

This code shows an ScriptTask, which is used as an global ErrorHandler in an SSiS Task.
It could be used also in Parent-Child architectures, where Tasks will be called by a Main Task.
The ErrorHandling will be controlled by several variables, which


Logging

LOG_Error As Integer = &H1
LOG_Warning As Integer = &H2
LOG_Info As Integer = &H4
LOG_Verbose As Integer = &H8
LOG_MsgBox As Integer = &H10
LOG_UserVars As Integer = &H100
LOG_SysVars As Integer = &H200

Used Variables

Logging: LogLevel
varTaskSuccess : ReturnCode of the ChildTask
PkgExecKeyLocal: Local variable to hold the InstanceGUID, if varImportID doesn't exist
varCS: Connection string for making the database connection and write the error into database
varImportID : Key which combines the error with the package
varRecordCounter: Count of records, if any to be updated in the PacakgeExecutionTable

ErrorLevel (TaskLevel, RO) : Defines the ErrorLevel for which we catch the error, default = 0
ErrorCatchLevel (Parent, RW) : Globale variable, will be set to Level, if a OnErrorHandler runs
Check this, if Level < CatchLevel (or CatchError = 0), we log the stuff
The Level will be incremented by the errHandler hierarchy (first child will get 1)
ErrorDisableDBLogging: (TaskLevel, RO) : Do not logging into database
ErrorChild (Parent, RW): If ErrorDisableDBLogging is true, this varibale holds the error message
ErrorRethrow (Parent, RO): Set System::Propagate to true or false,
means the error will be thrown to the next upper caller
ErrorTask (Parent, RW): Holds the Stacktrace (PackjageNames) from bottom to top (revered in conjunction with java/C#)
ErrorAdditionalVariables (TaskLevel, RO): Comma seperated list of variables to log

ErrorLevel and ErrorCatchLevel

In a two level process (ParentChild), there is no need to set the ErrorLevel variable!
But in more deep processes, we control via this variable the behavior of the error catching mechanism from
bottom to top. So if we would have a 3 level architecture, and in the bottom task was an error, this would get the
CatchLevel = 1. In the middle task the variable would be CatchLevel = 2 and in to top most level, this would be
catchLevel = 3

Properties