Appendix C. Handling exceptions and errors 467
Mode-specific On Error
If an error occurs during a Connector Interface operation, then the On Error Hook
for the Connector mode is invoked
. This Hook is not mandatory, so having it not
enabled will not cause additional exceptions to be thrown.
After the mode-specific
On Error Hook is executed (or skipped, if not enabled)
flow continues to the
Default On Error Hook.
Default On Error
Although other error Hooks can precede it - like On Connection Failure or
Mode-Specific On Error described in the previous sections - this is the error
Hook that is ultimately called for any error-exception thrown during Connector or
Function operation.
If this Hook is not enabled then the AssemblyLine aborts with the error and the
On Failure Hook is invoked. However, if Default On Error is enabled, the
exception is effectively "swallowed" and control is passed to the next AL
An important part of any error handling scheme is logging. Of course, logging
has other uses as well; like passing data to other applications, or writing an
AssemblyLine audit trail. As a result, this chapter will deal with logging in more
general terms than just error handling.
TDI uses a Java API for logging called
Log4j. This flexible framework provides a
rich set of features that TDI leverages in such a way as to pass this flexibility on
to you. It is not necessary that you know how Log4j works to do logging in TDI.
However, any knowledge you do have can be directly applied to your solutions.
So without going into the gritty details, logging in log4j can be thought of in three
logger, appender, and layout.
The first part (
logger) refers to the mechanism that enables logging, and this bit
handled for you by TDI.
The second term (
appender) is also a job for TDI. This work is carried out a
logging component called, not surprisingly, an Appender. TDI provides a range of
appenders that each supports a specific log system or mechanism.
This is also true of connection failures as well, although the On Connection Failure (and possibly
Reconnect feature, if enabled) is executed first.
468 Robust Data Synchronization with IBM Tivoli Directory Integrator
Finally, layout defines the format in which your log messages are written. You
define the layout for an Appender by setting its parameters.
More information about this topic can be found in the Logging and debugging
section of the IBM Tivoli Directory Integrator 6.0: Administrator Guide,
Figure C-4 The IDI File Roller appender
The window in Figure C-4 is of the IDI File Roller Appender, and the top two
parameters are specific to this component. Here you tell the Appender what file
to use as well as how many backup copies it should maintain. The next two
parameters - Layout and Pattern - are how the log messages are to be written.
Finally, the Log Level parameter instructs the logger feature in TDI which
message priority levels to enable for this Appender. There are five levels to
choose from: DEBUG, INFO, WARN, ERROR, and FATAL; in ascending order of
priority. This parameter controls how verbose the Appender will be and setting
one level will enable that priority plus all those that are higher. For example, if you
set the log level to FATAL, then only this level of messages will be written by the
Appender. However, setting it to WARN means that it will handle ERROR and
FATAL as well.
Logging can be defined at the Config level, as well as for specific AssemblyLines.
Setting up how all AssemblyLines in a Config will do their logging is done under
the Config folder of the Config Browser as shown in Figure C-5. Here you will see
an Item called Logging.
Appendix C. Handling exceptions and errors 469
Figure C-5 Setup logging - config level
Selecting this item brings up a Logging Details window where you can add and
remove Appenders that will be applied to all ALs.
In addition to Config-level settings, each AssemblyLine offers a Logging tab
where you can specify further Appenders for this task. This is shown in our final
capture in Figure C-6.
Figure C-6 Setup logging tab
470 Robust Data Synchronization with IBM Tivoli Directory Integrator

Get Robust Data Synchronization with IBM Tivoli Directory Integrator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.