One Star

How to use tDie, tSendMail & log errors into a file

Hi,
I am trying to create a process to copy new incoming data from MySQL to Oracle. I want to be able to stop the process if errors occur; send an email to the administrator and log the errors into a file.
Below is my process I am trying to define, however, I encountered the following problems for the tDie:
==> If this component has output, there must be an input link to propagate the data
tMySQLInput --> Main --> tMap --> Main --> tOracleInput
| |
OnComponentError OnComponentError
| |
tDie --> Main --> tSendMail tDie --> Main --> tSendMail
tlogCatcher --> Main --> tFileOutputDelimited
In addition, will the "tlogCatcher --> Main --> tfileOutputDelimited" flow logs the errors into a file? If not, how should I define the flow in order to log the errors in a log file?
Any help is appreciated? Thanks in advance!
6 REPLIES
Community Manager

Re: How to use tDie, tSendMail & log errors into a file

Hello
In addition, will the "tlogCatcher --> Main --> tfileOutputDelimited" flow logs the errors into a file? If not, how should I define the flow in order to log the errors in a log file?

Yes, once tDie is fired, the tLogCatcher will catch the message define on tDie and log them into a file/db.
Your job looks like:
tMySQLInput --> Main --> tMap --> Main --> tOracleOutput
| |
OnComponentError OnComponentError
| |
tSendMail--onComponentOK--tDie tSendMail---oncomponentok--> tDie
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to use tDie, tSendMail & log errors into a file

Hi Shong,
Thanks for your help! I am wondering is there any ways to log tmap if tmap has an error?
Best Regards!
Community Manager

Re: How to use tDie, tSendMail & log errors into a file

Hello
I am wondering is there any ways to log tmap if tmap has an error?

Yes, tlogCatcher catch all the runtime exception occurs on any a component.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to use tDie, tSendMail & log errors into a file

Hi Shong,
I encountered an error in the tmap with the following messages:
Starting job JOB_ERROR_LOG at 18:32 03/02/2010.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from long to BigDecimal
at test_log_n_error.job_error_log_0_1.JOB_ERROR_LOG.tMysqlInput_1Process(JOB_ERROR_LOG.java:2330)
at test_log_n_error.job_error_log_0_1.JOB_ERROR_LOG.runJobInTOS(JOB_ERROR_LOG.java:3276)
at test_log_n_error.job_error_log_0_1.JOB_ERROR_LOG.main(JOB_ERROR_LOG.java:3169)
connecting to socket on port 4155
connected
Job JOB_ERROR_LOG ended at 18:32 03/02/2010.
However, tlogcatcher which suppose to create the logs in an excel file was not updated. Can you please help if I need to create another flow to track tmap error?
Thanks again!
Community Manager

Re: How to use tDie, tSendMail & log errors into a file

Hello
Exception in thread "main" java.lang.Error: Unresolved compilation problem:

It is a compilation problem, not a runtime exception, the job does't work if there is a compilation error in generated code. First, you should correct the compilation error.
From your error message, we can see it can't now convert from long to BigDecimal, so you need conver to long to BigDelimal like this:
new BigDecimal(row1.columnName)
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to use tDie, tSendMail & log errors into a file

Hi Shong,
Thanks for your detailed explanations!