Skip to content
Advertisement

tlogcatcher component not catching error for tMSSqlRow read error

I develop some jobs with Talend, and use Tlogcatcher to record errors on a database. It seems working for all jobs except one.

enter image description here

Here is how it work:

The first SQL connection read SQL statement from a database table, and for each of them, the tMSSqlRow read and execute it.

But when SQL failed (i.e delete not possible cause of constraint integrity), the error is not caught by the tLogCatcher component.

How I can do that?

Advertisement

Answer

tLogCatcher is not supposed to be used like you did in your job (with OnComponentError/OnSubjobError triggers), it has to be the first component of an independent subjob (not linked by a trigger) which gets called whenever there is an error/warning/java exception, depending on which types you check in tLogCatcher settings.
If you want to keep the OnComponentError trigger, you can omit the tLogCatcher altogether and just do your error processing in the subjob triggered by OnComponentError.
Also, make sure you check “Die on error” option in your tMSSqlRow component, otherwise no error is thrown and the job just prints an error message to the console and continues execution, thus the tLogCatcher won’t be invoked.

Edit:

Based on your requirement (continue job execution on error), a solution would be to encapsulate the processing that happens starting from tMSSqlRow onward (as well as the error handling technique I suggested above) in a child job.
This child job needs to define a context parameter (for instance QUERY) and does the processing for this single query. The parent job calls this child job with an Iterate trigger, and passing it each query to be processed via the QUERY context parameter (the global variable that is in your tFlowToIterate is passed to QUERY context parameter in the tRunJob parameters tab).
This way, if your query processing in the child job results in an error, it is handled inside the child job by the tLogCatcher, and the parent job isn’t aware of this error, so it continues to the next query.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement