How can I print useful error log file?

One Star

How can I print useful error log file?

Hi,
I have one main input and tow output tables. To keep the transaction complete, I set if table 2 failed, then table 1 needs to be rollbacked. Please see the attached picture.
The rollback data is OK but I wonder how can I print out the message why table 2 has error? for example, log supposes to tell me which row and which column is failed because it is NULL or type incorrect or FK constraint.
How to do the print useful log files?
Thanks,
Vincent
Community Manager

Re: How can I print useful error log file?

Hello
Use the tLogCatcher to catch the error message, please see the user documentation and leran its usage.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How can I print useful error log file?

Hi, Shong:
If you can look at the first picture, I want to print out the failed message before rollback. For example, I want to know which row id is failed.
Thank you,
One Star

Re: How can I print useful error log file?

Connect that rejects flow to a delimited text file and you can capture the error messages generated by your database.
The rejects flow (at least on my DB2 components) adds two extra fields/columns to the end of the flow that show error information.
Here's an example of one of my jobs (see attached).
Output for the last two columns looks like this in my case:
||DB2 SQL error: SQLCODE: -117, SQLSTATE: 42802, SQLERRMC: null
One Star

Re: How can I print useful error log file?

Thank you, SMaz.
Also my case is parent/child tables, so if child table failed, then rollback parent table. My child delimitedfile should print out the error message. To make this work, I need to set customer buffer size to 1 for flush the result.
I attached the picture to explain it. If there is another way, please correct me.
Another question for SMaz, why do you add tDie component? I am curious.
One Star

Re: How can I print useful error log file?

I use tDie to abort the execution of the job and to allow me to specify an error code which becomes the "return value" passed to the script file that called my Talend job. By setting a different error code for each of my tDie components, I can tell where the job has failed.
This is useful in a production environment - once you have deployed your jobs to a server and you are not running them interactively through TOS.