Configuring logs and exceptions
tJobLog, tJobFailure and tLogCatcher
components to define log information, collect exception data and transfer it to the
Studio console or to
Talend Integration Cloud
web application during execution.
This helps you
to analyze and debug the execution of Integration Action, Jobs or Flows.
- The Log4j option is enabled in the project settings. For further information,
see
Talend Studio for Cloud Developer
Guide.
-
.Open the Integration Action you already defined and drop the
following components from the Palette into
the design workspace: tLogCatcher,
tJobLog (x2) and tJobFailure.
If you have imported the Integration
Cloud Demos project, you can drop a ready-to-use exception
handling subjob from the Joblets node in
the Repository tree view. For further
information about the demo project, see
Talend Studio for Cloud Developer
Guide. - Link the components together using the Main links.
-
Double-click tLogCatcher component and select the
Catch Java Exception check box in the component
basic settings.If you use the Joblet from the demo project, this option is selected by
default -
Double-click the first tJobLog component and
set the following parameters in the component basic settings:-
Select the Developer option and set the
java expression of the log message in the Log
message field, for example:"Component: " + row1.origin + "
| Error type: " + row1.type + "| Error code: " + row1.code + "
| Error message: " +
row1.message.This logs the error messages to the Studio.
-
Select the error type from the Priority
list.
-
-
Double-click the second tJobLog component and
set the following parameters in the component basic settings:-
Select the User option and set the java
expression of the log message in the Log
message field, for example:row2.message.This logs the error messages to the web application.
-
Select the error type from the Priority
list.
-
-
Double-click tJobFailure and set the following
parameters in the component basic settings:-
Set Execution failed as the error type in the
Error Type field.You can define the error type according to your needs and the value you
define in this field will show in the run detail page when you run a Flow in
the Could web application. -
Set the java expression of the message in the Error
Message field, for example as the following:row3.job + ":" + row3.origin +": " + row3.messageYou can define the error message according to your needs.
For further information about handling logs and exceptions in the
Studio, see
Talend Studio for Cloud Developer Guide. -